+ 1
Prompt to Number Conversion?
If I prompt a question that entails a numerical answer (200, for example), how can I use 200 as a number rather than a string in future commands?
1 ответ
+ 2
For an example;
var x = Number(prompt("First num"));
var y = Number(prompt("Second num"));
alert(x + y);
Or
var x = +prompt("First num");