πŸ”Ή Introduction to Arrays

What is an Array? πŸ€”

An array is a special data structure in JavaScript used to store multiple values in a single variable. Think of it like a train πŸš† where each compartment holds a different passenger (data).

Why use Arrays?

Example:

let fruits = ["Apple", "Banana", "Cherry"];
console.log(fruits[0]); // "Apple" (First element)
console.log(fruits[2]); // "Cherry" (Third element)


πŸ”₯ Array Methods and Properties

Now, let’s explore essential array methods with fun explanations & examples!


πŸ”Ή Spread Operator (...) – Expanding Arrays Like Magic 🎩

The spread operator (...) allows you to expand an array into individual elements. Imagine unpacking a suitcase 🧳 where each item is laid out separately.

πŸ“Œ Use Cases: