_.toLength

_.toLength(value)

Converts value to an integer suitable for use as the length of an array-like object.

Note: This method is based on ToLength.

Since

4.0.0

Arguments

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

Returns

(number): Returns the converted integer.

Example

_.toLength(3.2);
// => 3
 
_.toLength(Number.MIN_VALUE);
// => 0
 
_.toLength(Infinity);
// => 4294967295
 
_.toLength('3.2');
// => 3
doc_Lodash
2016-11-27 16:41:15
Comments
Leave a Comment

Please login to continue.