ES6 - Number.parseInt()


Advertisements

This method parses a string argument and returns an integer of the specified radix.

Syntax

Number.parseInt(string,[ radix ])

Parameter Details

  • string − value to parse

  • radix − integer between 2 and 36 that represents the base.

Return Value

An integer representation of the string.

Example

console.log(Number.parseInt("10")); 
console.log(Number.parseInt("10.23"));

Output

10 
10
es6_number.htm
Advertisements