Chapter 8. Arrays: putting data into lists

This chapter covers

  • Grouping values as lists
  • Creating an array
  • Accessing elements in an array
  • Manipulating the elements in an array
  • Using forEach to visit each element

Almost everything you’ve covered so far has been about organizing your data or organizing your code. This chapter continues that theme but with a twist: it’s not just about grouping items; now you can put them in order.

In The Crypt, you’ll finally have the ability for players to collect items they find on the journey; with arrays they can start on their very own treasure hoards.

8.1. Creating arrays and accessing elements

Working with lists is an essential part of programming. Blog posts, quiz questions, stock prices, ...

Get Get Programming with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.