Arrays

Arrays in JavaScript

Arrays are used to store multiple values in a single variable.

Code Examples
// Creating arrays\nconst fruits = ["apple", "banana", "cherry"];\nconst numbers = [1, 2, 3, 4, 5];\n\n// Array methods\nfruits.push("orange");\nfruits.pop();\n\n// Iteration\nfruits.forEach(fruit => console.log(fruit));\nconst doubled = numbers.map(n => n * 2);