Reputation: 21
<!DOCTYPE html>
<html>
<body>
/*how ican make String.fromCharCode(i)
i take value from 0 to 1000 so print out letter every time */
<p id="demo"></p>
<script>
var text = "";
var i;
for (i = 0; i < 1000; i++) {
/*String.fromCharCode(i) "i" print the letter only 1000
and i want to print from 0 to 1000 */
text = String.fromCharCode(i)+ "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
Upvotes: 2
Views: 917
Reputation: 144
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript For Loop</h2>
<p id="demo"></p>
<script>
let text = "";
for (let i = 0; i < 1000; i++) {
text += i + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
Upvotes: 1