1.1. What Is JavaScript?
JavaScript is the subject of a fair bit of misinformation and confusion.
Before proceeding any further, it is important to debunk two common and
persistent myths about the language.
1.1.1. JavaScript Is Not Java
One of the most common misconceptions about JavaScript is that it is a
simplified version of Java, the programming language from Sun Microsystems.
Other than an incomplete syntactic resemblance and the fact that both Java and
JavaScript can provide executable content in web browsers, the two languages
are entirely unrelated. The similarity of names is purely a marketing ploy by
Netscape and Sun (the language was originally called LiveScript; its name was
changed to JavaScript at the last minute). However, JavaScript can, in fact,
script Java (see Chapters 12 and 23).
1.1.2. JavaScript Is Not Simple
Because JavaScript is interpreted instead of compiled, it is often considered
a scripting language instead of a true programming language. The implication
is that scripting languages are simpler and that they are programming
languages for nonprogrammers. The fact that JavaScript is loosely typed does
make it somewhat more forgiving for unsophisticated programmers. And many web
designers have been able to use JavaScript for limited, cookbook-style
programming tasks.
Beneath its thin veneer of simplicity, however, JavaScript is a full-featured
programming language, as complex as any and more complex than some.
Programmers who attempt to use JavaScript for nontrivial tasks often find the
process frustrating if they do not have a solid understanding of the language.
This book documents JavaScript comprehensively so that you can develop a
sophisticated understanding. If you are used to cookbook-style JavaScript
tutorials, you may be surprised at the depth and detail of the chapters ahead.