Lodash _.toNumber() Method
Last Updated :
25 Oct, 2023
Lodash _.toNumber() method is used to convert the given value to a number.
Syntax:
_.toNumber(value);
Parameters:
- value: This parameter holds the value to convert.
Return Value:
This method returns the converted number.
Example 1: In this example, we are converting the given value into the number using the _.toNumber() method.
Javascript
const _ = require( "lodash" );
console.log(_.toNumber(15.6));
console.log(_.toNumber( '15.6' ));
|
Output:
15.6
15.6
Example 2: In this example, we are converting the given value into the number using the _.toNumber() method.
Javascript
const _ = require( "lodash" );
console.log(_.toNumber(Number.MIN_VALUE));
console.log(_.toNumber(Number.MAX_VALUE));
|
Output:
5e-324
1.7976931348623157e+308
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...