This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by tivnanmatt
almost 12 years

3.5 "Missing ;" error on line 5

var isLost = function (n) { for(i=0, i<count, i++) { if ( n === lost[i]) { return true }; }; return false; };

That is my code starting on line 5 But even when I reset the code to how it starts, there is an error on line 5 saying “Missing ; “ and if I try to run the code, it says: “Syntax Error: Unexpected token )” I’ve been working at it for a while and I cant figure it out

Answer 4fd8b2e54dacfa00030280e3

1 vote

Permalink

var lost = [4, 8, 15, 16, 23, 42]; var count = lost.length;

var isLost = function (n) { for (i=0; i<=42; i++) { if ( n === lost[i]) { return true; } } return false; };

points
Submitted by praxthemax
almost 12 years

Answer 4fd8ac9381e21500030278ca

0 votes

Permalink

Looks like you need to separate the initialization of the for loop with semi-colons instead of commas

points
Submitted by James Bentley
almost 12 years