Appendix A. JavaScript Basics

JavaScript is a versatile, lightweight, and easy-to-use scripting language. It is most often used in websites and web-based applications, although it is becoming increasingly common to find it used on the server side using a server-side implementation of JavaScript such as Node.js. Some desktop and mobile applications are even starting to use JavaScript and HTML5.

Due to the wide usage and huge popularity of JavaScript, many libraries have been written for it, a few of which include jQuery, YUI, Dojo, and MooTools. jQuery is currently the most popular, with 85% of the market share and thousands of contributors. Many major projects are built off jQuery, such as jQuery Mobile, Twitter Bootstrap, and jQuery UI.

It is also extremely fast—Apple and Google’s fight for the fastest JavaScript engine (Safari’s Nitro and Chrome’s V8 engine, respectively) has pushed the engineers at both companies to improve the speed of the engines to the point where micro-optimizations are almost entirely unnecessary.

JavaScript is a very forgiving language, and often developers can make mistakes without them having an effect on the site; browsing the Internet with the JavaScript console open often displays errors on many big websites. Unfortunately, this has the side effect of allowing the developers to make mistakes of which they are not made aware, and they develop bad habits that they may then pass on to other people. A lot of online tutorials, and often even books, ...

Get Learning from jQuery 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.