JS: Number.parseInt (String to Number)
parseInt
Number.parseInt(string)-
Convert string to a integer.
// string to number console.assert( parseInt("324") === 324, ); Number.parseInt(string, radix)-
Use base radix.
// convert hexadecimal string to decimal console.assert( parseInt("ff", 16) === 255, ); // binary string to decimal console.assert( parseInt("1111", 2) === 15, );
Global Object
Number.parseInt
is the same as the
"parseInt" of
the Global Object.
console.assert( Number.parseInt === globalThis.parseInt, );