+ 3
Why d (variable)is treated as string
I don't know why it's happening d is treated as string https://code.sololearn.com/WruS83awNHHw/?ref=app
5 Antworten
+ 3
That's because prompt accepts strings only.
Do like the following:
var y = Number(prompt("Enter year"));
+ 5
use parseInt to convert it to integer.
+ 2
thx a lot
+ 2
how to split a numeric data input
like I have to use 3 of 5340
0
Covert it to a string, then get the index of your number and catch it with substr.
For example,
var x = 5340
alert(x.toString().substr(1,1))