Common Array Methods

JavaScript arrays come with many useful built-in methods:

  • push() – Add item to end
  • pop() – Remove last item
  • shift() – Remove first item
  • unshift() – Add item to beginning
  • slice() – Extract portion
  • splice() – Modify contents
const nums = [1, 2, 3, 4];
nums.push(5); // [1,2,3,4,5]
nums.splice(1, 2); // [1,4,5]
← PrevNext →