Chapter 4
Understanding Arrays
IN THIS CHAPTER
Identifying and defining arrays
Building arrays
Moving beyond 2D with multidimensional arrays
Working within array elements
Using array functions and properties
“I am large. I contain multitudes.”
— WALT WHITMAN
Arrays are a fundamental part of any programming language. In this chapter, you discover what they are, how to use them, and what makes JavaScript arrays distinct from arrays in other programming languages. You work with arrays to create lists, order lists, and add and remove items from lists.
Making a List
The earlier chapters in this book involve working with variables that are standalone pieces of data, such as: const myName = "Chris"
, let firstNumber = "3"
, and var how ManyTacos = 8
. There are often times in programming (and in life) where you want to store related data under a single name. For example, consider the following types of lists:
- A list of your favorite artists
- A program that selects and displays a different ...
Get Coding All-in-One For Dummies, 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.