Bug at Learn Javascript For Loop Part


#1


https://www.codecademy.com/courses/learn-javascript/lessons/loops/exercises/for-loops-iii?action=lesson_resume


I have written the code correctly. I saw the solution code. The only difference with my code and the solution is that I wrote curly by indentation.
This error is showing-"Did you a for loop that loops over the myPlaces array?"


Replace this line with your code. 
THIS IS MY CODE:
var myPlaces=["Bandarban","Khagrachori","Sundarban"];
var friendPlaces=["Coxsbazar","Bandarban","Sylhet"];

for(var i=0;i<myPlaces.length;i++)
  {
    console.log(myPlaces[i]);
  }

THIS IS THE SOLUTION CODE:
var myPlaces=["Bandarban","Khagrachori","Sundarban"];
var friendPlaces=["Coxsbazar","Bandarban","Sylhet"];

for(var i=0;i<myPlaces.length;i++){
    console.log(myPlaces[i]);
  }

Check out the curly braces in the for loop.


#2

1.First,I'd suggest to not look for solution. It will not help you in long run.
2.Second your first code is fine,Try to refresh the page and submit it.


#3

Tried again. The problem is only if I write the first curly brace on the next line, the error shows. But It's not supposed to show error for that.


#4

I tested both code,In console. worked fine.

try changing browser.


#5

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