Skip to Content
JavaScript: The Definitive Guide, 5th Edition
book

JavaScript: The Definitive Guide, 5th Edition

by David Flanagan
August 2006
Intermediate to advanced
1018 pages
34h 13m
English
O'Reilly Media, Inc.
Content preview from JavaScript: The Definitive Guide, 5th Edition

Chapter 3. Datatypes and Values

Computer programs work by manipulating values, such as the number 3.14 or the text “Hello World.” The types of values that can be represented and manipulated in a programming language are known as datatypes, and one of the most fundamental characteristics of a programming language is the set of datatypes it supports. JavaScript allows you to work with three primitive datatypes: numbers, strings of text (known as strings), and Boolean truth values (known as booleans). JavaScript also defines two trivial datatypes, null and undefined, each of which defines only a single value.

In addition to these primitive datatypes, JavaScript supports a composite datatype known as an object. An object (that is, a member of the datatype object) represents a collection of values (either primitive values, such as numbers and strings, or composite values, such as other objects). Objects in JavaScript have a dual nature: an object can represent an unordered collection of named values or an ordered collection of numbered values. In the latter case, the object is called an array. Although objects and arrays are fundamentally the same datatype in JavaScript, they behave quite differently and will usually be considered distinct types throughout this book.

JavaScript defines another special kind of object, known as a function. A function is an object that has executable code associated with it. A function may be invoked to perform some kind of operation. Like arrays, functions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaScript: The Definitive Guide, 7th Edition

JavaScript: The Definitive Guide, 7th Edition

David Flanagan
JavaScript from Beginner to Professional

JavaScript from Beginner to Professional

Rob Percival, Laurence Svekis, Maaike van Putten, Codestars By Rob Percival

Publisher Resources

ISBN: 0596101996Supplemental ContentErrata Page