6. Complex Variable Types

Chapter 4, Simple Variable Types, introduced the basics of working with variables in JavaScript, including the simplest of types: strings, numbers, and Booleans. The true potential of any language comes through its complex data types. In JavaScript, this primarily means arrays and objects, although I’ve included the Date type in this chapter, too. While arrays are common to all languages (in one format or another), JavaScript’s implementation of objects is significantly different from any other language, and key to understanding JavaScript as a whole.

Generating Dates and Times

The first complex type to be discussed in this chapter is the Date object. Although Date is used quite differently than the array and (generic) ...

Get Modern JavaScript: Develop and Design 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.