A JavaScript Primer

Because JavaScript is used as the basis for XML scripting examples throughout this chapter, I thought it would help to quickly review the basic syntax of the JavaScript language. If you're already a JavaScript guru, feel free to skip this section. If not, brace yourself for the fastest JavaScript primer ever attempted.

JavaScript scripts are created as plain text code, including statements that follow a structure and syntax somewhat similar to the Java programming language. The JavaScript language syntax can be broken into the following major components:

  • Statements

  • Variables

  • Expressions

  • Comments

  • Functions

  • Objects

Statements

JavaScript statements are interpreted on a line-by-line basis. A statement typically consists of a combination ...

Get XML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.