Background and Rationale

Why JavaScript?

Although it has been around since 1995, JavaScript has recently experienced a resurgence of newfound interest and popularity. JavaScript was originally designed to be the scripting language for web browsers, and is still required knowledge for anyone designing a web application today. Nowadays, JavaScript has far outgrown this initial purview, and exists in its own right as a general-purpose scripting language thanks to the node.js development environment. JavaScript may even be used as a scripting language inside Max, allowing you to integrate Max and JavaScript smoothly and seamlessly.

While JavaScript works just fine on its own, programmers usually supplement the language with open-source libraries and/or frameworks that assist with the tasks at hand. For audio applications, there exists the Web Audio API, which is a specification that allows you to play sound from a web browser. Whereas the Web Audio API usually operates at lower level, tone.js is a higher-level library that uses the Web Audio API as a backbone to build more fleshed-out audio-related tools and interfaces.

A Brief History of JavaScript (Or, Why JavaScript Is Weird)

All told, JavaScript's success is somewhat amazing. The language was designed and implemented in ten days, by a Netscape Navigator employee named Brendan Eich. Eich had a number of forward-looking ideas, but was hamstrung by 1) this unreasonable time limitation, and 2) his employer's insistence that the language look superficially similar to other popular programming languages of the day. Eich originally wanted to name his language "Mocha"—this despite the fact that Sun Microsystems had just come out with a hot new language called "Java". Since Netscape Navigator was actually collaborating with Sun Microsystems at this time, Netscape was essentially able to piggyback off the notoriety of Sun's more-popular language, so they changed Eich's name from "Mocha" to "JavaScript". Needless to say, the confusion—among both programmers and laypeople—continues to this day. A word of warning: if you are a Java programmer, don't be fooled by the superficial similarity between Java and JavaScript: they are very different languages, and require different ways of thinking and structural organization.

For at least a decade after it was born, JavaScript was considered a "toy" language, good for little more than making a button flash on a web page or a link change color. This perception began to change in the late 00s. In 2008, Douglas Crockford released a book called JavaScript: The Good Parts that emphasized the sophisticated and beautiful aspects of the language, and provided tools for mitigating the bad and awful parts. In 2009, Ryan Dahl released node.js, which freed JavaScript from the web browser and allowed it to be used in all sorts of other applications. Nowadays, it is one of the most popular languages in the world.

Yet, underneath it all, JavaScript is still that idiosyncratic language designed under immense pressure and with limited foresight, and as such, it comes with more than its share of blemishes and warts. For a time, programmers attempted to sidestep JavaScript's issues by inventing "better" JavaScript alternatives that would transpile to vanilla JavaScript, the most popular of these being CoffeeScript, TypeScript, and Dart. This transpilation-craze has partially abated since 2015, when a new version of JavaScript—called ECMAScript 2015 (aka ES2015 aka ES6)—incorporated and formalized many of the helpful features introduced in those languages. These new features are now supported by all modern browsers, and are quickly becoming an established standard.



Resources and Links

Since JavaScript is one of the most popular languages in the world, we are not providing our own complete series of intro-to-JavaScript tutorials, as to avoid NIH syndrome. Instead, we expect you to learn the language on your own, from various tutorials and/or books linked here. While this may seem like a tall order, you'll find that learning your second programming language will be much easier than learning your first, not to mention that the ability to quickly learn and translate between languages will be essential when working in the real world!

This topic contained a short primer describing JavaScript syntax, as well as a number of videos summarizing the differences between JavaScript and other languages you may know. (Here, here, and here.) You should have finished this topic's lessons with no problem. But if things still seem too confusing or over-your-head, or you would like to get a little bit more practice, then you should spend some time with a few of the resources and links provided below.

Finally, don't forget to go through the self-test we have created at the end of this topic: if you feel comfortable answering each of those questions, you are ready to move on to the more advanced parts of this course.

What We Expect You to Know

What We Don't Expect You to Know



Other Resources to Learn HTML

Other Resources to Learn JavaScript

Above and Beyond

The following subjects are not strictly-speaking relevant for this course, but if you can surmount the additional learning curves, you'll find that your web-based projects will be easier to code and far more elegant.