24.3. Mastering JavaScript Syntax

The fundamental syntax of JavaScript looks a lot like Java or C. Most simple constructs will look familiar: if, “? :”, while, for, break, and continue are used just as in the Java programming language. JavaScript 1.2 added a switch statement that looks very similar to Java's switch, with the exception that the case values need not be integers. The operators + (addition and string concatenation), -, *, /, ++, --, &&, ||, and so forth are virtually identical. Trailing semicolons are optional, but we use them throughout for the sake of familiarity. We outline several important features here; details are given in the next chapter (JavaScript Quick Reference).

Also note that Netscape provides a convenient interactive ...

Get Core Web Programming, Second Edition 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.