Lesson 12 loops and arrays II


#1

Hey I have been working on this for some time now, and cant figure it out. heres my code and the error it creates

var names = ["Maranda", "Herman", "Arnold", "Nathan"];

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

the error is

SyntaxError: missing ) after argument list

I don't see where I should add a ")"


#2

Hi here inside the console.log

console.log("I know someone called " " + names[i]);

This part called " " + names[i] should be like that

called " +  "  "  + names[i]

#3

ok this is my code

var names = ["Maranda", "Herman", "Arnold", "Nathan"];

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

but i still have the same error


#4

You missing a ) and if it stIll doesn't work try it like that.

console.log("I know someone called " + names[i])

#5

thanks that was it :slightly_smiling:


#6

Also if you format your code like I did for you using the 3 backtiks:

you already see from the color where things start to go wrong (if it is a problem of syntax).


#7

you have used an extra double quote " after the string
console.log("I know someone called " " + names[i]);
your statement should be like this
console.log("I know someone called " + names[i]);
or this
console.log("I know someone called" + " " + names[i]);