_.toInteger

_.toInteger(value)

Converts value to an integer.

Note: This method is loosely based on ToInteger.

Since

4.0.0

Arguments

  1. value (*): The value to convert.

Returns

(number): Returns the converted integer.

Example

1
2
3
4
5
6
7
8
9
10
11
_.toInteger(3.2);
// => 3
  
_.toInteger(Number.MIN_VALUE);
// => 0
  
_.toInteger(Infinity);
// => 1.7976931348623157e+308
  
_.toInteger('3.2');
// => 3
doc_Lodash
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.