Chapter 7
Working with Arrays
IN THIS CHAPTER
Learning what arrays can do for you
Declaring an array variable
Populating an array with data
Trying out multidimensional arrays
Working with JavaScript’s Array object
I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.
— BILL GATES
In this chapter, you discover one of JavaScript’s most important concepts: the array. Arrays are important not only because they’re extremely powerful, but because once you know how to use them, you’ll think of a thousand and one uses for them. To make sure you’re ready for your new array-filled life, this chapter explains what they are and why they’re so darn useful, and then explores all the fantastic ways that arrays can make your coding life easier.
What Is an Array?
I talk quite a bit about efficient programming in this book because I believe (okay, I know) that efficient scripts run faster and take less time to program and debug. As I’ve said, efficiency ...
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.
Read now
Unlock full access