Skip to main content Accessibility Feedback

Numbers

parseInt()

Convert a string into an integer (a whole number). The second argument, 10, is called the radix. This is the base number used in mathematical systems. For our use, it should always be 10.

// returns 42
parseInt('42', 10);

// also returns 42
parseInt('42px', 10);