Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

JavaScript Error: Unexpected Token

Posted on 2016-09-24
2
Medium Priority
?
190 Views
Last Modified: 2016-09-25
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!
0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Assisted Solution

by:Jeffrey Dake
Jeffrey Dake earned 1200 total points
ID: 41814259
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
 
LVL 22

Accepted Solution

by:
Kim Walker earned 800 total points
ID: 41814280
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question