Skip to main content

parseInt

_.parseInt(radix, string) # Ⓢ [Ⓣ][1] Ⓝ

Converts string to an integer of the specified radix. If radix is



undefined or 0, a radix of 10 is used unless value is a



hexadecimal, in which case a radix of 16 is used.





Note: This method aligns with the



ES5 implementation of parseInt.

Since​

1.1.0

Arguments​

  1. radix (number): The radix to interpret value by.
  2. string (string): The string to convert.

Returns​

(number): Returns the converted integer.

Example​

_.parseInt(10, '08');
// => 8

_.map(_.parseInt, ['6', '08', '10']);
// => [6, 8, 10]