JavaScript Arrays

Last updated: August 27, 2026.

An array is an ordered, zero-indexed collection.

const cars = ["Audi", "Bentley", "BMW"];
cars.push("Volvo");
for (const car of cars) {
  console.log(car);
}
const prices = [12.5, 8, 20];
const taxed = prices.map((price) => price * 1.08);
const expensive = taxed.filter((price) => price >= 15);
const total = taxed.reduce((sum, price) => sum + price, 0);

Use an object or Map for named keys rather than string properties on an array.

admin

admin

Leave a Reply

Your email address will not be published.