how to change the values in an object using if and while loops javascript code example
Example 1: example of while loop in javascript with array length
var soccerTeams = ['Barca','Madrid','Gunners','City','PSG']
var x=0;
while( x <= soccerTeams.length) {
console.log(soccerTeams[x])
x++;
}
======== output ===========
Barca
Madrid
Gunners
City
PSG
undefined
5
Example 2: javascript while loop
while(condition) {
//whatever
}