Chapter 8: Arrays Keep Things in Order

Learning Objectives

Upon completion of this chapter, you should be able to do the following:

  1. Understand arrays, like strings, are indexed collections
  2. Create an array literal
  3. Create an array of size n with Array(n)
  4. Create arrays that store multiple types of values
  5. Create arrays that store other arrays (i.e. multi-dimensional arrays)
  6. Access elements within multi-dimensional arrays
  7. Find the length of an array using the .length method
  8. Index into an array using bracket notation
  9. Set an element of an array using bracket notation assignment
  10. Describe what it means for arrays to be mutable
  11. Understand what happens when asking for an element at index at which no element exists
  12. Use common array methods: concat, join, split, push, pop, shift, unshift, slice, reverse, sort, indexOf
  13. Convert character arrays to strings using .join('')
  14. Convert strings to characters arrays using .split('')

Key Terminology

While reading this chapter, you will notice the following key terms listed by the page they first appear on. As you read, you should make note of the definitions of these terms.

Arrays Are Like Strings

  1. array
  2. array length

Working with Arrays

  1. index
  2. undefined
  3. mutable

Array Methods

  1. .includes()
  2. .indexOf()
  3. .reverse()
  4. .sort()
  5. .pop()
  6. .push()
  7. .shift()
  8. .splice()
  9. .unshift()
  10. .concat()
  11. .join()
  12. .slice()
  13. .split()

Multi-Dimensional Arrays

  1. multi-dimensional array