Arrays in JavaScript
Arrays in JavaScript: What Is an Array, Adding and Removing Items, Looping Through an Array, Finding Things in an Array.
Updated
- What Is an Array (Novice): An array keeps a whole list of values, such as the songs on a road-trip playlist, under one name, and you reach each one by its position, counting from 0.
- Adding and Removing Items (Apprentice): Grow and shrink an array as things change, adding and removing items at the end with push and pop, at the front with unshift and shift, and in the middle with splice.
- Looping Through an Array (Apprentice): Visit every item of an array with a for loop, a for...of loop or forEach, and use a loop to add up or count things, such as a playlist's total play time.
- Finding Things in an Array (Apprentice): Ask an array questions instead of writing a loop for each one, with includes and indexOf for an exact value, and find, findIndex, some and every for any test you write.