toLength

Lang
since 4.0.0

Arguments

  • * The value to convert.

Returns

number the converted integer.

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

Note: This method is based on ToLength.

Example of Lodash _.toLength

_.toLength(3.2);
// => 3

_.toLength(Number.MIN_VALUE);
// => 0

_.toLength(Infinity);
// => 4294967295

_.toLength('3.2');
// => 3