Lodash _.isFinite() Method
Last Updated :
03 Nov, 2023
Lodash _.isFinite() method checks whether the given value is a primitive finite number or not and returns the corresponding boolean value.
Syntax:
_.isFinite(value);
Parameters:
- value: This parameter holds the value that is to be checked for a primitive finite number.
Return Value:
This method returns a Boolean value(Returns true if the given value is a finite number, else false).
Example 1: In this example, we are checking whether the given value is a finite number or not.
Javascript
const _ = require( 'lodash' );
console.log( "The Value is Finite : "
+ _.isFinite(10));
|
Output:
The Value is Finite : true
Example 2: In this example, we are checking whether the given value is a finite number or not. for Infinity, it returns false.
Javascript
const _ = require( 'lodash' );
console.log( "The Value is Finite : "
+ _.isFinite(Infinity));
|
Output:
The Value is Finite : false
Example 3: In this example, we are checking whether the given value is a finite number or not. for strings, it returns false.
Javascript
const _ = require( 'lodash' );
console.log( "The Value is Finite : "
+ _.isFinite( "gfg" ));
|
Output:
The Value is Finite : false
Example 4: In this example, we are checking whether the given value is a finite number or not.
Javascript
const _ = require( 'lodash' );
console.log( "The Value is Finite : "
+ _.isFinite(Number.MAX_VALUE));
|
Output:
The Value is Finite : true
Share your thoughts in the comments
Please Login to comment...