Week6day2 TraversingtheMatrix ArraysContinued

The Pop, Push, Queue, and Dequeue Array methods are a few more useful tools that we will be exploring today.

Array Functions The pop() method removes the last element from an array and returns that element. Example: let lastItem = arr.pop(); The push() method adds one or more elements to the end of an array and returns the new length of the array. Example: arr.push('newItem'); The shift() method removes the first element from an array and returns that element. Example: let firstItem = arr.shift(); The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array. Example: arr.unshift('newItem');

The push() method of Array instances adds the specified elements to the end of an array and returns the new length of the array.