0
How can write javascript in array for 1+2+3+4+5M
I TRIED BUT IT CAN'T SHOWS.
6 Respuestas
+ 3
what is that M?
0
sum = 0;
var crap = Array(5);
for(var i = 0; i < 5; i++ ){
crap[i] = priompt("enter the number");
sum = sum + crap[i];
}
document.write(sum);
In this case i want to display 15 but it's shows 012345 have you any idea???
0
User inputs are strings, you need to parse them to numbers.
0
how can change strings to number?
0
how can change it?
0
change the row like this:
sum = sum + Number(crap[i]);



