Chapter 8

Working with Arrays

IN THIS CHAPTER

Bullet Learning what arrays can do for you

Bullet Declaring an array variable

Bullet Populating an array with data

Bullet Trying out multidimensional arrays

Bullet 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

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. Efficiency in programming really means eliminating unnecessary repetition, whether it’s consolidating statements into a loop that can be repeated as often as required (refer to Book 3, Chapter 4) or moving code into a function that can be called as often as you need (refer to Book 3, Chapter 5).

In this chapter, you take your coding efficiency to an even higher level by exploring one of JavaScript’s most important concepts: the array. Arrays are important not only because they’re extremely efficient ...

Get Web Coding & Development 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.