9/12 Unexpected Token )


#1

// Click on "Stuck? Get a hint!" if you get stuck!
var names = ["Brian", "Maggie", "Chun", "Min", "Nicki"];
for (i = 0, i < names.length, i++) {
console.log("I know someone called:" + names[i]);
}
I don't get why there's an unexpected token!


#2

Separate for loop statements with semicolons, not commas.

for (i = 0; i < x; i++)


#3

Oh! I forgot! Thanks!


#4

But there still is a problem:
// Click on "Stuck? Get a hint!" if you get stuck!
var names = ["Brian"; "Maggie"; "Chun"; "Min"; "Nicki"];
for (i = 0, i < names.length, i++) {
console.log("I know someone called:" + names[i]);
}
Unexpected token!


#5

Oh, come on. You haven't changed your for loop statements separation (; instead ,) instead you messed up your array now.

Don't rush.


#6

Oh. Oops.
I'm just a 9 year old!!!!!!!!!!!!!!!!


#7

Oh my gosh. I must be rushing a lot because I don't still get that message. I tried it on Codecademy Labs, and the red circle with a x on it says:
"missing ]" Here is my current code:
// Click on "Stuck? Get a hint!" if you get stuck!
var names = ["Brian"; "Maggie"; "Chun"; "Min"; "Nicki"];
for (i = 0; i < names.length; i++) {
console.log("I know someone called:" + names[i]);
}
I hope you don't think I'm too stupid.


#8

I don't think you're stupid. I think you're not paying enough attention to details. Don't get offended by that, it's just an observation of what's been happening here.

I told you already, that you have messed up your array with semicolons. Items inside an array must be separated with commas.

var newArray = [item1, item2, item3];

Pay attention, kiddo :wink:


#9

Thanks. I did that, and it works. I think you meant put in the semicolons in the array, not the loops. Afterwards, I thought you meant both. It's been a while since I've done Javascript, because I got annoyed by a rock, paper, scissors lesson. Then I posted a question and it was solved. So, yeah, I sort of forgot how to use Javascript lessons. Also, I sort of got messed up because of the Khan Academy lessons.


#10

I have some thing simular but mine is
var names = ["Cobra", "Madyln", "Jack", "Loyd", "Rachael"];
for (i = 0; i < names.length; i++) {
console.log("I know someone called:" + names[i]);
}
It is asking if I declared a variable called junk how would I do that and where?
Please


#11

I am having hat same problem