JavaScript - Delete Elements from the End of a JS Array Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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. JavaScript let a = [1, 2, 3, 4]; // Remove last element a.pop(); console.log(a); Output[ 1, 2, 3 ] 2. Using splice() methodThe splice() method can remove elements from any index of the array, including the end. JavaScript let a = [1, 2, 3, 4]; // Remove last element a.splice(a.length - 1, 1); console.log(a); Output[ 1, 2, 3 ] 3. Using Destructuring AssignmentArray destructuring is used to extract the elements of the array except the last one and create a new array. JavaScript let a1 = [1, 2, 3, 4]; // Remove last element const [ ...a2 ] = a1; a2.length = a1.length - 1; console.log(a2); Output[ 1, 2, 3 ] 4. Using slice() MethodThe slice() method is used to remove the last element by specifying the end index. The slice() method creates a new array. JavaScript let a1 = [1, 2, 3, 4]; let a2 = a1.slice(0, -1); console.log(a2); Output[ 1, 2, 3 ] 5. Using length propertyThe JS length property is used to remove the last element of the array by setting the array.length to array.length - 1. JavaScript let a = [1, 2, 3, 4]; a.length = a.length - 1; console.log(a); Output[ 1, 2, 3 ] 6. Using Custom Loop The JS for loop is used to iterate from the first element to the second last element of the array copying the elements to the new array. JavaScript let a1 = [1, 2, 3, 4]; // Create a new array and copy elements except the last one let a2 = []; for (let i = 0; i < a1.length - 1; i++) { a2.push(a1[i]); } console.log(a2); Output[ 1, 2, 3 ] Comment More info A amit_singh27 Follow 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 Strings6 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)9 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 readJavascript Scope3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like