Nested Loop:


#1

I would like to find out why would I get an Error when I put a semi-colon (;), behind the for Loop statement

let myPlaces = [‘Cambodia’, ‘Taiwan’, ‘Thailand’];

let friendPlaces = [‘Taiwan’, ‘Japan’, ‘South Korea’];

for (let myPlacesIndex=0; myPlacesIndex < myPlaces.length; myPlacesIndex++); {

for (let friendPlacesIndex =0; friendPlacesIndex < friendPlaces.length; friendPlacesIndex++) {
if (myPlaces[myPlacesIndex] === friendPlaces[friendPlacesIndex]) {
console.log(friendPlaces[friendPlacesIndex]);
}
}
}


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.