Category JavaScript

JavaScript Array shift() Method

JavaScript Array.shift() method removes (or delete) the first element from an array and returns the element that it removed. The shift() method changes the length of an array. It works just like the pop() method, but with one difference: The…

JavaScript Array push() Method

JavaScript array provides a stack method named push() that is identical in execution to the push operation performed on the stack data structure. The push() method just works opposite to pop(). It appends one or more new elements at the…

JavaScript Array pop() Method

JavaScript provides a stack method named pop() to make an array behave like data structure. The pop() method removes (or delete) the last element of an array and returns the element that it removed. This method changes the length of…

JavaScript Array fill() Method

JavaScript Array.fill() is a very simple method added in ES6. It returns a modified array by filling all elements of an array with a specified value. The fill() method allows us to fill all elements of an array with a…

JavaScript Array Slice() Method

JavaScript Array.slice() method slices out or extracts a sequence out of an array. It returns a slice, or sub-array, of the specified array. Using slice() method, we can copy a portion of an array and assign it to a new…