Chapter 10. JavaScript: Arrays

 

With sobs and tears he sorted out Those of the largest size . . .

 
 --Lewis Carroll
 

Attempt the end, and never stand to doubt; Nothing’s so hard, but search will find it out.

 
 --Robert Herrick
 

Now go, write it before them in a table, and note it in a book.

 
 --Isaiah 30:8
 

’Tis in my memory lock’d, And you yourself shall keep the key of it.

 
 --William Shakespeare

OBJECTIVES

In this chapter you will learn:

  • To use arrays to store lists and tables of values.

  • To declare an array, initialize an array and refer to individual elements of an array.

  • To pass arrays to functions.

  • To search and sort an array.

  • To declare and manipulate multidimensional arrays.

Outline

10.1

Introduction

10.2

Arrays

10.3

Declaring and Allocating Arrays

10.4

Examples ...

Get Internet & World Wide Web: How to Program, Fourth 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.