Chapter 8: Arrays Keep Things in Order
Learning Objectives
Upon completion of this chapter, you should be able to do the following:
- Understand arrays, like strings, are indexed collections
- Create an array literal
- Create an array of size n with Array(n)
- Create arrays that store multiple types of values
- Create arrays that store other arrays (i.e. multi-dimensional arrays)
- Access elements within multi-dimensional arrays
- Find the length of an array using the
.length
method - Index into an array using bracket notation
- Set an element of an array using bracket notation assignment
- Describe what it means for arrays to be mutable
- Understand what happens when asking for an element at index at which no element exists
- Use common array methods:
concat
,join
,split
,push
,pop
,shift
,unshift
,slice
,reverse
,sort
,indexOf
- Convert character arrays to strings using
.join('')
- 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
- array
- array length
Working with Arrays
- index
- undefined
- mutable
Array Methods
.includes()
.indexOf()
.reverse()
.sort()
.pop()
.push()
.shift()
.splice()
.unshift()
.concat()
.join()
.slice()
.split()
Multi-Dimensional Arrays
- multi-dimensional array