Chapter 2: Javascript: An Overview

Introduction

JavaScript is a prototype-based, object-oriented, loosely-typed dynamic scripting language. It has powerful features from the functional world, such as closures and higher-order functions, that are of special interest here.

JavaScript is technically an implementation of the ECMAScript language standard. It’s important to know that with Node, because of v8, you’ll be primarily dealing with an implementation that gets close to the standard, with the exception of a few extra features. This means that the JavaScript you’re going to be dealing with has some important differences with the one that earned the language its bad reputation in the browser world.

In addition, most of the code you’ll write is in compliance with the “good parts” of JavaScript that Douglas Crockford enounced in his famous book, JavaScript: The Good Parts.

This chapter is divided into two parts:

• Basic JavaScript. The fundamentals of the language. They apply everywhere: node, browser, and standards committee.

• v8 JavaScript. Some features used in v8 are not available in all browsers, especially Internet Explorer, because they’ve recently been standardized. Others are nonstandard, but you still use them because they solve fundamental problems.

In addition, the next chapter covers the language extensions and features exclusively available in Node.

Basic JavaScript

This chapter assumes that you’re somewhat familiar with JavaScript and its syntax. ...

Get Smashing Node.js: JavaScript Everywhere, 2nd Edition 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.