JavaScript Indexed Collections
Learn about arrays and how to manipulate them.
1. Creating Arrays
Arrays are ordered lists of values. Here are two common ways to create them.
JavaScript Code
Live JavaScript representation with highlighted changes
const arr1 = new Array("apple", "banana");const arr2 = ["apple", "banana"];
2. Array Methods
JavaScript provides many useful methods for manipulating arrays. Try some of them out!
JavaScript Code
Live JavaScript representation with highlighted changes
const fruits = ["Apple", "Banana", "Cherry"];let result = fruits.push("Durian");console.log("Result:", result);console.log("Array:", fruits);
Console Output