Stuck on 5/7 - for loops inside of for loops


JS: Stuck on 5/7 - for loops inside of for loops

Well, the exercise asks me to do this:

Write a for loop that iterates through each item in myPlaces and logs out each place.

And i wrote this code:

I even get the output in the console. It does print out the values but, the error that is shown is:

Did you a for loop that loops over the myPlaces array?

Can anyone please help

var myPlaces = ['Chicago','Paris','Barcelona'];
var friendPlaces = ['Paris','Mumbai','Sydney'];

for(var i =0; i < myPlaces.length; i++)


var myPlaces = ["a","b","c"];
var friendPlaces = ["c","d","e"];
for (var i = 0; i < myPlaces.length; i++) {
  for (/*Create you second for loop here, with a variable other than i, such as j*/) {
      if (/*Check if anything in your myPlaces is the same as friendPlaces*/) {
      /*If so,log it to the console.*/ console.log(myPlaces[i]);

Hope this helps you!


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