0
I am practicing html javascript. At chapter about array, I use the syntax:
var arr = new Array(5); for (var i=0; i<arr.length; i++) arr[i] = i; for (var i=0; i<arr.length; i++) document.writeln(i + " " + arr[i]); The problem is, the output can not displayed or viewed. What is the problem with my code? Thank you class & sololearn team.
2 Answers
+ 2
works fine for me though ....
you could try using console.log or document.body.innerHTML+= i + " " + arr[i]
0
I see. But what is the different between the three console.log, document.body.innerHTML and document.write? The last comment document.write is even more looks like C# command.