For-3

 

A new way to use JavaScript for loop 

var i = 0;

var length = vehicles.length;var text = "";for (; i < length; ){ text += vehicles[i] + " "; i++; }


 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p id="demo"></p> <script> var vehicles= ["Alto", "Zen", "Audi", "Swift"]; var i = 0; var length = vehicles.length; var text = ""; for (; i < length; ) { text += vehicles[i] + "<br>"; i++; } document.getElementById("demo").innerHTML = text; </script> </body> </html>
Output