var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; array.length = 4; //array = [1,2,3,4]
we can remove the last Element of an array using the
pop() method . The pop Method modifies the array on which it is invoked
For example :
var array = [1, 2, 3, 4]; array.shift(); //array = [2,3,4]
You like our Content? Follow us to stay up-to-date.