Using Arrays (integer, index, associative array)

5. The pop() and shift() Method


          In order to remove an element in an array, the method pop() and shift() will be used. The pop() method will remove the last element of an array while the shift() method will remove the first element of an array.

For example,

var myArray = ["Jack", "Sawyer", "John", "Desmond", "Kate"];

myArray.pop(); //Removes "Kate"

myArray.shift(); //Removes "Jack"

console.log(myArray); //Prints ["Sawyer", "John", "Desmond"]