Converts value to a safe integer. A safe integer can be compared and represented correctly.
value
The value to convert.
Returns the converted integer.
5.7.0
toSafeInteger(3.2)// => 3toSafeInteger(Number.MIN_VALUE)// => 0toSafeInteger(Infinity)// => 9007199254740991toSafeInteger('3.2')// => 3 Copy
toSafeInteger(3.2)// => 3toSafeInteger(Number.MIN_VALUE)// => 0toSafeInteger(Infinity)// => 9007199254740991toSafeInteger('3.2')// => 3
Converts
value
to a safe integer. A safe integer can be compared and represented correctly.