I want to convert a string to an integer, How can I do that in JavaScript?
You can either use Number() function or parseInt() function is used to convert a string to an integer in Javascript
Number()
parseInt()
Usage:
Number(str); parseInt(str);