O'Reilly logo

Professional, JavaScript® for Web Developers, Second Edition by Nicholas C. Zakas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Language Basics

At the core of any language is a description of how it should work at the most basic level. This description typically defines syntax, operators, data types, and built-in functionality upon which complex solutions can be built. As previously mentioned, ECMA-262 defines all of this information for JavaScript in the form of a pseudolanguage called ECMAScript (often pronounced as "ek-ma-script").

ECMAScript as defined in ECMA-262, Third Edition, is the most-implemented version among web browsers. The Fourth Edition introduced new syntax, operators, objects, and concepts that dramatically alter how JavaScript works. For this reason, and due to a lack of support, the following information is based only on ECMAScript as defined in the Third Edition (see Chapter 22 for information on the Fourth Edition and JavaScript 2.0).

Syntax

ECMAScript's syntax borrows heavily from C and other C-like languages such as Java and Perl. Developers familiar with such languages should have an easy time picking up the somewhat looser syntax of ECMAScript.

Case-sensitivity

The first concept to understand is that everything is case-sensitive: variables, function names, and operators are all case-sensitive, meaning that a variable named test is different from a variable named Test. Similarly, typeof can't be the name of a function because it's a keyword (described in the next section); however, typeOf is a perfectly valid function name.

Identifiers

An identifier is the name of a variable, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required