Why won't this code print? Please help a complete noob!


#1

https://www.codecademy.com/courses/javascript-beginner-en-NhsaT/2/4?curriculum_id=506324b3a7dffd00020bf661#


  var names = ["Jean", "Derry", "Danny", "Toni", "Molly"];

for (var i = 0; i < names.length; i++) {
    console.log("I know someone called " +names[i]);
}

I've edited a known good code and can make it work but I want to write it from scratch and really understand this before i move on.

I get the error "Unexpected token ="

Please can someone explain why this won't print?


#2

Try refreshing the page. I ran your code here:

http://jsbin.com/pubalajeha/edit?js,console

Seems to work.


#3

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