Updating an Array's Content
Learn how to modify the contents of an array.
We'll cover the following...
We'll cover the following...
Adding an element to an array
Now, let’s add another movie to our list: Ghostbusters.
Press + to interact
Javascript (babel-node)
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 ...