A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-islength-method/ below:

Lodash _.isLength() Method - GeeksforGeeks

Lodash _.isLength() Method

Last Updated : 04 Sep, 2024

Lodash _.isLength() Method checks whether the given value is an Array-like length or not and returns the corresponding boolean value.

Syntax:
_.isLength(value);
Parameters: Return Value:

Example 1: In this example, it is printing true in the console as 100 is a valid length.

JavaScript
// Defining Lodash variable 
const _ = require('lodash');

// Checking for Length
console.log("The Value is Length : "
    + _.isLength(100));

Output:

The Value is Length : true

Example 2: In this example, it is printing false in the console as Infinity and string are not valid lengths.

JavaScript
// Defining Lodash variable 
const _ = require('lodash');

// Checking for Length 
console.log("The Value is Length : "
    + _.isLength(Infinity));
console.log("The Value is Length : "
    + _.isLength("len"));

Output:

The Value is Length : false 
The Value is Length : false

Example 3: In this example, it is printing true in the console as Number.MAX_VALUE return a number that is a valid length.

JavaScript
// Defining Lodash variable 
const _ = require('lodash');

// Checking for Length 
console.log("The Value is Length : "
    + _.isLength(Number.MAX_VALUE));

Output:

The Value is Length : true


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4