jskatas.org Continuously Learn JavaScript. Your Way.

Number API: Number.parseInt()

Number.parseInt() parses a string and returns an integer.

Number.parseInt() parses a string and returns an integer.

it is a static function on Number
const whatType = 'global'; assert.equal(whatType, typeof Number.parseInt);
is the same as the global function parseInt
const global = () => globalThis || window || global; const parseIntFunction = Number.parse_int; assert.equal(parseIntFunction, global().parseInt);
parseInt was specified in ECMAScript v1 (please find that ES1 kata for learning more)
const version = 6; assert.equal('ECMAScript v' + version, 'ECMAScript v1');


Description of `Number.parseInt()` in the specification.
The MDN docs for this function.
Spec chapter of the global `parseInt()` function.
A twitter thread, where I explained the decision process of the creation of this kata and how it relates to the ES1 kata of this function.

Required Knowledge

Related Katas

Number API

Difficulty Level


First Published

6 October 2019


3 tests to solve