jskatas.org Continuously Learn JavaScript. Your Way.

Global Object API: parseInt() in depth

parseInt() converts a given value to a string and then tries to make an integer out of it.

parseInt() parses a string and returns an integer.

ignores any surrounding white spaces for a given string
const stringNumber = ' abc '; assert.equal(parseInt(stringNumber), 123);