Web Development · JavaScript

Which method is used to add an element at the end of an array in JavaScript?

Beginner
~1 min answer
0 views
0 likes
2026
Quick Answer

push() method adds elements at the end of array.

MCQ Options
A unshift()
B push()
C pop()
D concat()
Detailed Answer
push() method adds one or more elements to the end of an array and returns the new length.

arr.push("item") - adds at end
arr.pop() - removes from end
arr.unshift() - adds at beginning
arr.shift() - removes from beginning
Example / Code
let fruits = ["apple","banana"]; fruits.push("mango"); // ["apple","banana","mango"]
Interview Tips

Remember all 4 methods: push/pop (end), unshift/shift (beginning).

Common Mistakes

Confusing push() with unshift() which adds at beginning.

Related Skills
JavaScript Arrays Data Structures