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



  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?


Try refreshing the page. I ran your code here:


Seems to work.


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