Delete the first element of array without using shift() method in JavaScript Last Updated : 22 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Given an array containing some array elements and the task is to remove the first element from the array and thus reduce the size by 1. We are going to perform shift() method operation without actually using it with the help of JavaScript. There are two approaches that are discussed below: Table of ContentMethod 1: Using splice() MethodMethod 2: Using filter() MethodMethod 3: Using slice() MethodMethod 1: Using splice() MethodWe can use the splice() method that is used to get the part of the array.Example: In this example, we will implement the above approach. JavaScript let Arr = ['Geeks', 'GFG', 'Geek', 'GeeksForGeeks']; console.log("Array: [" + Arr + "]"); function myGFG() { Arr.splice(0, 1); console.log("Elements of Array: [" + Arr + "]"); } myGFG(); OutputArray: [Geeks,GFG,Geek,GeeksForGeeks] Elements of Array: [GFG,Geek,GeeksForGeeks] Method 2: Using filter() MethodWe can use the filter() method to filter out the element at index 0.Example: In this example, we will implement the above approach. JavaScript let Arr = ['Geeks', 'GFG', 'Geek', 'GeeksForGeeks']; console.log("Array: [" + Arr + "]"); function removeFirst(element, index) { return index > 0; } function myGFG() { Arr = Arr.filter(removeFirst); console.log("Elements of array = [" + Arr + "]"); } myGFG(); OutputArray: [Geeks,GFG,Geek,GeeksForGeeks] Elements of array = [GFG,Geek,GeeksForGeeks] Method 3: Using slice() MethodWe can use the slice() method to create a new array starting from the second element.Example: In this example, we will implement the above approach. JavaScript let Arr = ['Geeks', 'GFG', 'Geek', 'GeeksForGeeks']; console.log("Array: [" + Arr + "]"); function myGFG() { Arr = Arr.slice(1); console.log("Elements of Array: [" + Arr + "]"); } myGFG(); OutputArray: [Geeks,GFG,Geek,GeeksForGeeks] Elements of Array: [GFG,Geek,GeeksForGeeks] Comment More infoAdvertise with us Next Article Delete the first element of array without using shift() method in JavaScript P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to remove specific elements from the left of a given array of elements using JavaScript ? In this article, we will learn How to remove specific elements from the left of a given array of elements using JavaScript. We have given an array of elements, and we have to remove specific elements from the left of a given array. Here are some common approaches: Table of Content Using splice() met 2 min read How to delete an element from an array using JavaScript ? The array is a type of data structure that allows us to store similar types of data under a single variable. The array is helpful to create a list of elements of similar types, which can be accessed using their index. In this article, we will discuss different ways to remove elements from the array. 5 min read JavaScript - Delete First Occurence of Given Element from a JS Array These are the following ways to delete elements from a specified Index of JavaScript arrays:1. Using indexOf() and splice() - Most UsedThe indexOf() method finds the first occurrence of the element in the array, and splice() removes it at that index. This approach directly modifies the original arra 2 min read JavaScript - Delete Elements from the End of a JS Array These are the following ways to delete elements from the end of JavaScript arrays:1. Using pop() methodThe pop() method is used to remove the last element from an array and returns the modified array.JavaScriptlet a = [1, 2, 3, 4]; // Remove last element a.pop(); console.log(a);Output[ 1, 2, 3 ] 2. 2 min read JavaScript - Delete Element from the Beginning of JS Array These are the following ways to delete elements from JavaScript arrays:1. Using shift() method - Mostly UsedThe shift() method removes the first element from the array and adjusts its length.JavaScriptconst a = [1, 2, 3, 4]; // Remove the first element a.shift(); console.log(a);Output[ 2, 3, 4 ] 2. 2 min read Like