current generation of web applications possible—browser-based email
clients, maps, and social networks—and is also used in more traditional
sites to provide various forms of interactivity and cleverness.
It is important to note that JavaScript has almost nothing to do
with the programming language named Java. The similar name was in-
spired by marketing considerations, rather than good judgment. When
JavaScript was being introduced, the Java language was being heavily
marketed and was gaining in popularity. Someone thought it a good
idea to try to ride along on this success. Now we are stuck with the
name.
After its adoption outside of Netscape, a standard document was writ-
ten to describe the way the JavaScript language should work, to make
sure the various pieces of software that claimed to support JavaScript
were actually talking about the same language. This is called the EC-
MAScript standard, after the ECMA organization, which did the stan-
dardization. In practice, the terms ECMAScript and JavaScript can be
used interchangeably—they are two names for the same language.
There are those who will say terrible things about the JavaScript lan-
guage. Many of these things are true. When I was required to write
something in JavaScript for the first time, I quickly came to despise it—
it would accept almost anything I typed but interpret it in a way that
was completely different from what I meant. This had a lot to do with
the fact that I did not have a clue what I was doing, of course, but there
is a real issue here: JavaScript is ridiculously liberal in what it allows.
The idea behind this design was that it would make programming in
JavaScript easier for beginners. In actuality, it mostly makes finding
problems in your programs harder, because the system will not point
them out to you.
This flexibility also has its advantages, though. It leaves space for a lot
of techniques that are impossible in more rigid languages, and, as we will
see, for example, in the
chapter on modules, it can be used to overcome
some of JavaScript’s shortcomings. After learning the language properly
and working with it for a while, I have learned to actually like JavaScript.
There have been several versions of JavaScript. ECMAScript version
3 was the dominant, widely supported version in the time of JavaScript’s
ascent to dominance, roughly between 2000 and 2010. During this time,
work was underway on an ambitious version 4, which planned a number
7