0
Why when I enter data by "prompt" and want to add it add up as text strings?
And how can I fix it? I mean, how can I turn that string into a number?
1 Resposta
+ 6
It happens because prompt by default returns String.
To convert it to number you can simply use the Number()
for example:
var xyz = Number(prompt())