Chapter 9. Arrays
Chapter 8 documented the
JavaScript object type -- a composite data type that holds named
values. This chapter documents arrays -- a composite data type
that holds numbered values. Note that the arrays we'll discuss
in this chapter are different from the associative arrays described
in the previous chapter. Associative arrays associate values with
strings. The
arrays described in this chapter are just regular numeric arrays;
they associate values with non-negative integers.
Throughout this book, we often treat objects and arrays as distinct
data types. This is a useful and reasonable simplification; you can
treat objects and
arrays as separate types for most of your
JavaScript programming. To fully understand the behavior of objects
and arrays, however, you have to know the truth: an array is nothing
more than an object with a thin layer of extra functionality. We see
this when we use the
typeof operator: applied to an array value,
it returns the string "object". Note that the extra
functionality of arrays was introduced in JavaScript 1.1. Arrays are
not supported in JavaScript 1.0.
This chapter documents basic array syntax, array programming
techniques, and methods that operate on arrays.
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.