+ 1
Can i convert string to int in js
Example : if user inputs some number from input box by html the javascript takes that value as string so how can i make it a int as we do in python
2 Respuestas
+ 2
you can use
let num = Number.parseInt(string);
(You can ommit the “Number.” If you want)
+ 2
a=prompt(”Enter an integer value :”);
p=parseInt(a);
The above steps can take input and convert it to integer format