You've learned how to add items with .push()
, remove items with .pop()
, and check the size with .length
. Let's practice using these methods together.
Engagement Message
Ready to become an array methods expert?
Type
Fill In The Blanks
Markdown With Blanks
Let's build a task tracker. Fill in the blanks to complete the code that starts with an empty array, adds two tasks, and checks how many items you have.
Suggested Answers
- push
- push
- .length
- []
- pop
Type
Multiple Choice
Practice Question
Which method would you use to add a new score to the end of a scores array?
A. scores.length
B. scores.push(newScore)
C. scores.pop()
D. scores[0] = newScore
Suggested Answers
- A
- B - Correct
- C
- D
