While Loop

A while loop loops through a block of code as long as a specified condition is true.

Code Structure
var cities = ["London", "Reading", "Liverpool", "Basingstoke"];
var i = 0;
while (i < cities.length) {
    var cityLists = cities[i];
    i++;
    alert(cityLists);
} 

Share this

Related Posts