JavaScript - Delete last Occurrence from JS Array Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report These are the following ways to remove the last Item from the given array: 1. Using pop() Method (Simple and Easiest Method for Any Array) The pop() method is used to get the last element of the given array it can also be used to remove the last element from the given array. JavaScript let a = [34, 24, 31, 48]; a.pop(); console.log(a); Output[ 34, 24, 31 ] 2. Using Array splice() Method (Simple for Long Array)This method uses Array.splice() method that adds/deletes items to/from the array and returns the deleted item(s). JavaScript let a = [34, 24, 31, 48]; a.splice(-1, 1); console.log(a); Output[ 34, 24, 31 ] 3. Using Array slice() Method(Efficient for Any Array)We are using Array.slice() method. This method returns a new array containing the selected elements. This method selects the elements that start from the given start argument and end at, but excludes the given end argument. JavaScript let a = [34, 24, 31, 48]; console.log(a.slice(0, -1)); Output[ 34, 24, 31 ] 4. Using Array length Property(Simple and Easy Way For Long Array)The array length property in JavaScript is used to set or return the number of elements in an array. JavaScript let a = [34, 24, 31, 48]; a.length = a.length - 1; console.log(a); Output[ 34, 24, 31 ] 5. Using Spread Operator (...)(Efficient for Short Array)The spread operator (...) is a concise way to manipulate arrays. To remove the last element from an array, you can use the spread operator along with array destructuring. JavaScript let a = [34, 24, 31, 48]; let res = [...a.slice(0, -1)] console.log(res); Output[ 34, 24, 31 ] 6. Using Array.reduceRight() Method(Efficient for Short Array)The reduceRight() method applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value. This method can be utilized to create a new array excluding the last element. JavaScript let a = [34, 24, 31, 48]; let a1 = a.reduceRight((ac, c, idx) => { if (idx !== a.length - 1) { ac.unshift(c); } return ac; }, []); console.log(a1); Output[ 34, 24, 31 ] Comment More info P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies javascript-array JavaScript-Questions 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