Posts

Showing posts from March, 2022

JavaScript Array (Push, Pop, Shift, Unshift)

Image
Array pop(), push(), shift() and unshift() Methods in JavaScript pop() :  Remove an item from the end of an array pop() returns the removed item. The method takes no arguments. push() :  Add items to the end of an array push() returns the new array length. The value which is an argument passed to the method could be a number, string, object or even array. shift() :  Remove an item from the beginning of an array shift() returns the removed item. The method takes no argument. unshift() :  Add items to the beginning of an array unshift() returns the new array length. The method takes an argument of value which could be object, array, string, etc.