var cars = ["BMW", "Volvo", "Saab", "Ford"];
var i = 0;
var text = "";
while (cars[i]) {
text += cars[i] + "<br>";
i++;
}
console.log('text: ' + text);Syntax:
do {
code block to be executed
}
while (condition);var text = "";
var i = 0;
do {
text += "The number is " + i;
i++;
}
while (i < 5);