Remove an element at the end of the array

Remove an element at the end of the array.

javascript array


Using length 

array-length

Output = [1, 2, 3, 4, 5]


Using pop()

pop() method removes last element from an array and returns that elements.

array-pop

Output = [1, 2, 3, 4, 5]


Using Splice()

Splice() method changes an array by removing or replacing existing elements and/or adding new elements in place.

array-splice

Output = [1, 2, 3, 4, 5]










Previous Post Next Post