Doug Winnie shows how add elements to an array using the push() function. Then he shows how to change, or overwrite, existing elements with new values. Finally, Doug shows how to remove elements from an array using the splice() function.
Inside of the push() function call,…add in the item you want to add to the array.…You can add multiple items by separating each with a comma,…then send the array to the console to display it.…Save and open the webpage in your browser.…You'll see that the second array is now displayed…and has an additional item inside of it,…with the new element that you have pushed onto the end.…There is one thing I wanted to point out…that might be a bit confusing.…If you expand and open the first array in the console panel,…
- Setting up your development environment
- Working with values and variables
- Using and customizing functions
- Creating conditional tests
- Using loops
- Creating and changing arrays