0
can we get output of the string (text) also with the numbers for two variables in the statement 1 ?
for (i=1, text=""; i<=5; i++) { text = i; document.write(i + "<br />"); }
6 Answers
0
seems like you havent tried it Selina.
just try it and see what happens. thats how you learn.
if you are not able to solve it, then ask questions
0
I don't understand how to imply this:
text=i;
where i is an integer and text is a string .
0
if I input some text even it only prints the integer value only
for (i=1, text="miraz"; i<=5; i++) {
text = i;
document.write(i + "<br />");
}
output :
1
2
3
4
5
0
javascript generally auto converts number to string. otherwise use:
text = i.toString();
0
because you are over writing the value in first line of loop.
try text = text + i.toString();
it will concatenate the numbers.
0
ok . thanks .