Updating an Array's Content

Learn how to modify the contents of an array.

Adding an element to an array

Now, let’s add another movie to our list: Ghostbusters.

Press + to interact
const movies = ["The Wolf of Wall Street", "Zootopia", "Babysitting"];
movies.push("Ghostbusters");
console.log(movies[3]); // "Ghostbusters"

You add a new item to an array with the ...