JavaScript For Kids For Dummies
Book image
Explore Book Buy On Amazon

Unlike in strings in JavaScript, the contents and spelling of text outside of quotes matters a lot. When text isn't surrounded by quotes (single or double) in JavaScript, it's considered part of the code of the JavaScript program.

JavaScript code is very picky about spelling and capitalization. In JavaScript code, the following words are completely different:

FOR
for
For

Only the one in the middle means anything special to JavaScript. If you try to use the other two in the message printer program, you'll get an error, as shown here.

Capitalizing a JavaScript keyword wrong produces errors.
Capitalizing a JavaScript keyword wrong produces errors.

JavaScript is also very picky about spelling. Many times, when you're coding and something just isn't working right, the problem turns out to be that you accidentally left out a letter or mixed up the order of two letters.

Just as typos in writing often go unnoticed, these types of errors can be very difficult to track down, so get into the habit early on of typing slowly and carefully, and you'll save yourself a lot of time in the long run!

About This Article

This article is from the book:

About the book authors:

Chris Minnick and Eva Holland are experienced web developers, tech trainers, and coauthors of Coding with JavaScript For Dummies. Together they founded WatzThis?, a company focused on training and course development.

This article can be found in the category: