Getting Items by Number
Pick items using their position.
Grabbing Treasures 🤲
Hi, treasure grabber! 🌟 How do we get ONE item out of a list?
We use its position number inside [ ]! 🔢
let treasure = ["gold", "gem", "crown"]
console.log(treasure[0])Counting Starts at Zero! 0️⃣
Surprise! Lists count from 0, not 1!
The first item is at position [0]. 🤯
let pets = ["cat", "dog", "fish"]
console.log(pets[0])All lessons in this course
- What Is an Array?
- Getting Items by Number
- Adding and Removing Items
- Looping Through a List