JavaScript- Delete from a Given Position of JS Array Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 1 Likes Like Report These are the following ways to delete an item from the given array at given position: 1. Using the splice() Method(Most efficient for in-place modifications)The splice() method is the most versatile way to remove elements from any position in an array. It allows you to specify the index where the removal should start and the number of elements to remove. JavaScript const a = [1, 2, 3, 4, 5]; let idx = 2; a.splice(idx, 1); console.log(a); Output[ 1, 2, 4, 5 ] 2. Using slice() and concat() Methods(Less efficient in terms of memory and speed)While slice() does not modify the original array, you can use it to create a new array that excludes the element at the specified position. By combining slice() with concat(), you can efficiently delete an element from a given position. JavaScript const a = [1, 2, 3, 4, 5]; const res = a.slice(0, 2).concat(a.slice(3)); console.log(res); Output[ 1, 2, 4, 5 ] 3. Using the filter() Method(Efficient when removing by value, not position)If you know the value of the element you wish to delete (rather than its index), the filter() method can help. It creates a new array with all elements that pass a test defined by the callback function. JavaScript const a = [1, 2, 3, 4, 5]; let idx = 3; const res = a.filter(i => i !== idx); console.log(res); Output[ 1, 2, 4, 5 ] 4. Using Destructuring to Skip Elements(Less efficient and not ideal for positional deletions)Although it's not a built-in method for deleting elements, you can use array destructuring to create a new array that excludes the element at the specified position. This method is a bit more declarative and might be useful in scenarios where you want to handle array manipulations in a concise manner. JavaScript const a = [1, 2, 3, 4, 5]; const [first, second, , ...rest] = a; console.log([first, second, ...rest]); Output[ 1, 2, 4, 5 ] Comment M meetahaloyx4 Follow 1 Improve M meetahaloyx4 Follow 1 Improve Article Tags : JavaScript Web Technologies javascript-array Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like