Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

JS - Loop

0 votes
26 views
added Mar 6 in Javascript by LC Marshal Captain (23,680 points)
<p id="sample"></p>

<script>
var cars = ["F150", "Bronco", "Ranger", "Everest", "Escape", "Expedition"];
var text = "";
var i;
for (i = 0; i < cars.length; i++) {
  text += cars[i] + "<br>";
}
document.getElementById("sample").innerHTML = text;

// output
// F150
// Bronco
// Ranger
// Everest
// Escape
// Expedition

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...