JavaScript: Number.parseInt
Syntax
Number.parseInt(string)
-
Convert string to a integer.
// string to number console.log(parseInt("324") === 324);
Number.parseInt(string, radix)
-
Use base radix.
// hexadecimal string to number console.log(parseInt("ff", 16) === 255);
// binary string to number console.log(parseInt("101", 2) === 5);
Number.parseInt and window.parseInt
Number.parseInt
is the same as the
the Global Object's
parseInt
console.log(Number.parseInt === globalThis.parseInt);