In this chapter, we examine the pros and cons of JavaScript.
“ECMAScript 6” (short: “ES6”) refers to a version of JavaScript
ECMAScript is the name of the language standard; the number X in “ECMAScript X” and “ESX” refers to a version of that standard. Initially the versions were ordinal numbers (ES1–ES6). Later, they were years (ES2016+). For more information, see “Standardization: JavaScript vs. ECMAScript” (§5.2).
Among programmers, JavaScript isn’t always well liked. One reason is that it has a fair amount of quirks. Some of them are just unusual ways of doing something. Others are considered bugs. Either way, learning why JavaScript does something the way it does, helps with dealing with the quirks and with accepting JavaScript (maybe even liking it). Hopefully, this book can help.
Additionally, many traditional quirks have been eliminated now. For example:
let
and const
, which let us declare block-scoped variables.
function
and .prototype
was clumsy. ES6 introduced classes, which provide more convenient syntax for these mechanisms.
Lastly, JavaScript’s standard library is limited, but:
On the plus side, JavaScript offers many benefits.
JavaScript’s popularity means that it’s well supported and well documented. Whenever we create something in JavaScript, we can rely on many people being (potentially) interested. And there is a large pool of JavaScript programmers from which we can hire, if we need to.
No single party controls JavaScript – it is evolved by TC39, a committee comprising many organizations. The language is evolved via an open process that encourages feedback from the public.
With JavaScript, we can write apps for many client platforms. These are a few example technologies:
JavaScript is supported by many server platforms and services – for example:
There are many data technologies available for JavaScript: many databases support it and intermediate layers (such as GraphQL) exist. Additionally, the standard data format JSON (JavaScript Object Notation) is based on JavaScript and supported by its standard library.
Lastly, most tools for JavaScript are written in JavaScript or at least support plugins written in it. Even native tools are installed the same way as all other JavaScript-related software – via package managers such as npm.
There is much innovation in the JavaScript ecosystem: new approaches to implementing user interfaces, new ways of optimizing the delivery of software, and more. The upside is that we will constantly learn new things. The downside is that the constant change can be exhausting at times. Thankfully, many things have become stable – e.g., built-in modules (ECMAScript modules) were introduced in 2015 but took nearly 10 years to become more popular than their non-built-in alternative, CommonJS Modules.