Pop operation in array using node.js


Overview

pop method in arrays is used to remove the element from the end of the array.

Code


													
//Name of the file : array-pop.js
arr = [ 5 , 5 , 8 , 7 , 6 ];
console.log(arr);
arr.pop();
console.log(arr);														
												

Run

  • Now run the snippet using the following command :
    													
    >node array-pop.js
    [ 5, 5, 8, 7, 6 ]
    [ 5, 5, 8, 7 ]