parseInt()

A function that reads a whole number from the beginning of a string.

What does parseInt() do in JavaScript?

parseInt() — A function that reads a whole number from the beginning of a string.

const quantity = Number.parseInt("12 items", 10);

Level: Apprentice · More JavaScript terms at this level

Updated