Skip to Main Content
Webmaster in a Nutshell, Third Edition
book

Webmaster in a Nutshell, Third Edition

by Robert Eckstein, Stephen Spainhour
December 2002
Intermediate to advanced content levelIntermediate to advanced
576 pages
32h
English
O'Reilly Media, Inc.
Content preview from Webmaster in a Nutshell, Third Edition

Syntax

JavaScript syntax is modeled on Java syntax; Java syntax, in turn, is modeled on C and C++ syntax. Therefore, C, C++, and Java programmers should find that JavaScript syntax is comfortably familiar.

Case-Sensitivity

JavaScript is a case-sensitive language. All keywords are in lowercase. All variables, function names, and other identifiers must be typed with a consistent capitalization.

Whitespace

JavaScript ignores whitespace between tokens. You may use spaces, tabs, and newlines to format and indent your code in a readable fashion.

Semicolons

JavaScript statements are terminated by semicolons. When a statement is followed by a newline, however, the terminating semicolon may be omitted. Note that this places a restriction on where you may legally break lines in your JavaScript programs: you may not break a statement across two lines if the first line can be a complete legal statement on its own.

Comments

JavaScript supports both C and C++ comments. Any amount of text, on one or more lines, between /* and */ is a comment, and is ignored by JavaScript. Also, any text between // and the end of the current line is a comment, and is ignored. Examples:

// This is a single-line, C++-style comment.
/*
 * This is a multi-line, C-style comment.
 * Here is the second line.
 */
/* Another comment. */ // This too.

Identifiers

Variable, function, and label names are JavaScript identifiers. Identifiers are composed of any number of letters and digits, and _ and $ characters. The first ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Webmaster in a Nutshell, Second Edition

Webmaster in a Nutshell, Second Edition

Stephen Spainhour, Robert Eckstein

Publisher Resources

ISBN: 0596003579Purchase bookErrata Page