LearnFrenzy
Sign in Take a free test

Arrays · JavaScript Arrays MCQ · Question 2

What does push return? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

What does arr.push("x") return?

  • A The new length of the array Correct
  • B The updated array
  • C "x"
  • D undefined
Correct Answer: Option A

push and unshift return the new length. A common bug is arr = arr.push(x), which replaces the array with a number.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links