JavaScript Tutorial

The language for programming web pages.

JS Arrays

JavaScript Arrays

An array is a special variable that can hold more than one value. Arrays use numbered indexes starting from 0. Arrays are objects in JavaScript.

Common Array Methods:

  • push() — Add to end
  • pop() — Remove from end
  • shift() — Remove from start
  • unshift() — Add to start
  • map() — Transform each element
  • filter() — Filter elements
  • reduce() — Reduce to single value
  • find() — Find first match
  • includes() — Check if exists
  • sort() — Sort array

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics