Converting a string to an integer in Javascript
By Mike Sallese ·
Javascript example of converting a string to an int
To convert a string to an int, use parseInt():
const converted = parseInt("10");
console.log(converted);
// output: 10
Noteworthy details
- If no integer is found,
NaNwill be returned.
For other javascript examples: https://www.mikesallese.me/tags/javascript
About the author
Mike Sallese. I build Scribbl, an AI note taker with no bot in the call, and a few other pieces of software. Off the computer I am building a straw bale workshop.
X · Medium · GitHub · articles on other sites