JavaScript Error: Unexpected Token

I am  working on a exercise(End of Chapter 2) in the "Eloquent JavaScript" book.

I am trying to build a chessboard but I am getting an error, "Unexpected Token".

http://codepen.io/isogunro/pen/dpvKJp?editors=1012

Any help would be appreciated.

Thanks!
LVL 5
IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?
 
Kim WalkerConnect With a Mentor Web Programmer/TechnicianCommented:
Jeffrey Dake is correct about the error on line 3.

More specifically, unexpected token simply means that a token appeared where something else was expected. A token in javascript is a punctuation character or operator. There are several tokens in the third line of your javascript -- the parentheses, the equals operator, the semi-colons, the less-than-or-equal-to operator (<=), the positive increment operator (++), and the left curly brace. In this case, the parser was expecting a value for the equals operator but instead encountered the semi-colon statement terminator. So the semi-colon token was unexpected.
0
 
Jeffrey DakeConnect With a Mentor Senior Director of TechnologyCommented:
On the third line you don't have x set to anything.   Unexpected token is JavaScripts way of telling you that you have incorrect syntax.
0
All Courses

From novice to tech pro — start learning today.