Open In App

Lodash _.isNumber() Function

Last Updated : 04 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

Lodash _.isNumber() method is used to find whether the given value parameter is a number or not. If the given value is a number then it returns True value otherwise, it returns False.

Syntax:

_.isNumber(value); 

Parameters:

  • value: This parameter holds the value to check.

Return Value:

  • This method returns true if the value is a number, else false.

Example 1: In this example, we are checking whether the given value is a number or not by the use of the _.isNumber() method.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// Use of _.isNumber() method 

console.log(_.isNumber(10));
console.log(_.isNumber('GeeksforGeeks'));
console.log(_.isNumber(15.675));

Output:

true
false
true

Example 2: In this example, we are checking whether the given value is a number or not by the use of the _.isNumber() method.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// Use of _.isNumber()  
// method 

console.log(_.isNumber(true));
console.log(_.isNumber(Number.MIN_VALUE));
console.log(_.isNumber(Infinity));
console.log(_.isNumber('3'));

Output:

false
true
true
false

Similar Reads