What is the syntax error in my code for 13?


#1

var countries = ['USA', 'Brazil', 'France', 'Egypt', 'India', 'Australia'];
for ( i = 0, i < countries.length, i++); {
console.log('I have been to ' + countries[i]);
}

Could someone please tell me what is wrong with this code? It shows syntax error!!!


#2

The syntax for he for loop is like this

for(starting_value; loop_condition; increment_amount){
       //statement
}

so your code should be modified to this

 var countries = ['USA', 'Brazil', 'France', 'Egypt', 'India', 'Australia'];

for ( var i = 0; i < countries.length; i++) {
    console.log('I have been to ' + countries[i]);
}

Test it out on labs