Loops and arrays II - Introduction to 'For' Loops in JS


#1

Hey guys again, im having a small issue and i would like to be explained what im doing wrong here! Because i know my code is right, and i understand the loops!
My code:
var names ["Oskar", "Mads", "Bunnom", "Martin", "Piidom"];

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

Error: Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected token [

Explain me what am i doing wrong?


#2

var names ["Oskar", "Mads", "Bunnom", "Martin", "Piidom"];

your missing a = here.


#3

Oh sh*t i forgot thanks a lot haxor! :smiley:


#4

where the a ? i dont understand


#5

not the a. he said "="