10 Effective ways to Remove Element from an array in JavaScript

Do you want to know how to remove elements from an array in JavaScript?

Well, just keep reading to know these ten (10) effective and ultimate solutions that will help to remove the elements.

In this article, you’ll discover the secrets of removing elements from arrays in JavaScript.

Let’s start to explore multiple methods, including splice, filter, and more, with clear explanations and examples.

But before we dive into the solutions, let’s first understand the JavaScript Arrays.

What is array in JavaScript?

An array in JavaScript is like a container that can hold multiple values at once.

Each value is stored in a specific position, called an index, and you can access the values by referring to their index number.

Arrays are useful when you need to keep track of a list of items, like a shopping list or a list of names.

You can create an array using an array literal, which is just a list of values separated by commas and enclosed in square brackets.

For example, you could create an array of subjects like this:

 let subjects = ["English", "Math", "Programming", "Web Development", "History"];

Arrays are actually a special type of object in JavaScript, so if you use the typeof operator on an array, it will return “object”.

How to remove element from an array in JavaScript? 10 Effective solutions

Here are 10 solutions to find and remove an element from JavaScript array:

Solution 1: Using the splice() method

The splice() method can be used to add or remove elements from an array.

To remove an element, you can specify the index of the element you want to remove and the number of elements to remove.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
subjects.splice(0, 1); ✅ // Starting at index position 0, remove 1 elements
console.log(subjects);  

Output:

[ 'Math', 'Programming', 'Web Development', 'History' ]

Solution 2: Using the pop() method

The pop() method removes the last element from an array and returns that element. This method changes the length of the array.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let lastElement = subjects.pop(); ✅
console.log(lastElement); 
console.log(subjects); 

Output:

History (last element)

[ 'English', 'Math', 'Programming', 'Web Development' ]

Solution 3: Using the shift() method

The shift() method removes the first element from an array and returns that element. This method changes the length of the array.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let firstElement = subjects.shift(); ✅
console.log(firstElement);
console.log(subjects); 

Output:

English (First element)

[ 'Math', 'Programming', 'Web Development', 'History' ]

Solution 4: Using the filter() method

The filter() method creates a new array with all elements that pass the test implemented by the provided function.

You can use this method to create a new array without the element you want to remove.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let newSubjects = subjects.filter(item => item !== "English");  
console.log(newSubjects); 

Output:

[ 'Math', 'Programming', 'Web Development', 'History' ]

Solution 5: Using the slice() method

The slice() method returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included).

You can use this method to create a new array without the element you want to remove.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let newArray = subjects.slice(0, 2).concat(subjects.slice(3)); ✅
console.log(newArray); 

Output:

[ 'English', 'Math', 'Web Development', 'History' ]

Solution 6: Using the delete operator

The delete operator removes a property from an object. You can use this operator to remove an element from an array by deleting its property.

However, this will leave a hole in the array and is not recommended.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
delete subjects[1]; 
console.log(subjects);

Output:

[
  'English',
  <1 empty item>,
  'Programming',
  'Web Development',
  'History'
]

Solution 7: Using a loop

You can use a loop to iterate over the elements of an array and create a new array without the element you want to remove.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let newArray = [];
for (let i =0; i<subjects.length; i++){ ✅
    if (subjects[i] !=="English"){
        newArray.push(subjects[i]);
    }
}
console.log(newArray);

Output:

[ 'Math', 'Programming', 'Web Development', 'History' ]

Solution 8: Using reduce()

The reduce() method executes a reducer function on each element of the array and returns a single output value.

You can use this method along with concat() to create a new Array without the specified index.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
subjects = subjects.reduce((accu,item,index) => { ✅
if(index !== subjects.indexOf("Math")){
return accu.concat(item); 
}
return accu;
},[]);
console.log(subjects); 

Output:

[ 'English', 'Programming', 'Web Development', 'History' ]

Solution 9: Using forEach()

The forEach() method executes a provided function once for each element in an Array.

You can use this method along with push() to create a new Array without the specified index.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let newSubjects = [];
subjects.forEach((item,index) => { 
if(index !== subjects.indexOf("History")){
newSubjects.push(item);
}
});
console.log(newSubjects);

Output:

[ 'English', 'Math', 'Programming', 'Web Development' ]

Solution 10: Using Array.from()

The Array.from() static method creates a new Array instance from an iterable object.

You can use this method along with keys() and filter() methods to create a new Array without the specified index.

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
subjects = Array.from(subjects.keys()).filter(i => i !== subjects.indexOf("Web Development")).map(i =>  subjects[i]);
console.log(subjects);

Output:

[ 'English', 'Math', 'Programming', 'History' ]

How to remove first element from array in JavaScript?

You can remove the first element from an array in JavaScript using the shift() method.

As mentioned above, the shift() method removes the first element from an array and returns that element.

This method changes the length of the array.

Here’s an example:

let subjects = ["English", "Math", "Programming", "Web Development", "History"];
let firstElement = subjects.shift(); ✅
console.log(firstElement); 
console.log(subjects);

As you can see, we use the shift() method to remove the first element from the array and store it in the firstElement variable.

After calling the shift() method, the array is updated to contain only the remaining elements.

Output:

English (The first element)

[ 'Math', 'Programming', 'Web Development', 'History' ] (Remaining elements)

How to remove specific element from array in JavaScript?

To remove specific elements, you can use the splice() and filter() method. You can also use the loop.

Example code and output are already given above.

Conclusion

In conclusion, we explored ten effective solutions for removing elements from arrays in JavaScript.

Using these various methods such as splice, pop, shift, filter, slice, delete, looping, reduce, forEach, and Array.from, accompanied with clear explanations and illustrative examples.

You can now remove elements from JavaScript arrays.

We are hoping that this article provides you with enough information that helps you understand how to remove elements from an array in JavaScript.

If you want to dive into more JavaScript topics, check out the following articles:

Thank you for reading itsourcecoders 😊.

Frequently Asked Questions

Is JavaScript still worth learning in 2026?
Yes. JavaScript runs on 98% of websites for the front-end, dominates the back-end via Node.js, powers mobile apps through React Native, builds desktop tools through Electron, and is the scripting layer for most AI tooling (LangChain.js, OpenAI SDK, Vercel AI). Whether you target web, mobile, AI, or full-stack capstones, JavaScript is the broadest single language you can learn.
What is the difference between var, let, and const?
var is function-scoped, hoisted to the top of its scope, and can be redeclared, which leads to bugs in modern code. let is block-scoped (only visible inside the nearest {}) and can be reassigned. const is block-scoped and cannot be reassigned, although object contents can still mutate. Default to const for everything, switch to let only when you actually need to reassign, and avoid var in any code written after 2017.
Which JavaScript version should I target in 2026?
Target ES2020 (ES11) as the safe baseline because every modern browser and Node.js 14+ supports it fully. ES2022 adds useful features like top-level await, private class fields with the # prefix, and the .at() array method. If you are writing for older browsers (IE11 or older Android WebViews), transpile down with Babel or use a build tool like Vite, esbuild, or webpack.
What is the best free editor for JavaScript?
Visual Studio Code is the industry standard, free, with built-in IntelliSense, debugger, terminal, Git, and a huge extension marketplace (ESLint, Prettier, GitHub Copilot, Tailwind). Install the JavaScript and TypeScript Nightly extension for the latest language features. JetBrains WebStorm is more powerful and free for students with a verified .edu email. For quick scratchpad work, the Chrome DevTools Sources panel includes a workspace and breakpoint debugger.
How do I run JavaScript locally vs in the browser?
In the browser: open DevTools with F12 (or right-click then Inspect), go to the Console tab, type or paste your code, press Enter. For HTML pages, add a script tag pointing to your .js file. Locally with Node.js: download Node from nodejs.org (LTS version), then run node script.js in your terminal from the file folder. Use the same Node setup for backend capstones, API integrations, and scripts that do not need a browser.
What can I build with JavaScript for my BSIT capstone?
Common BSIT capstones in JavaScript: full-stack web apps using React or Vue on the front-end with Node.js and Express on the back-end (MongoDB or MySQL for the database), real-time chat or notification systems using Socket.io, single-page dashboards with Chart.js or D3.js, cross-platform mobile apps with React Native, AI-powered chatbots using OpenAI SDK and LangChain.js, and Chrome extensions for productivity tools. Add Tailwind CSS for the UI and Vercel or Netlify for free deployment.

Caren Bautista


Technical Writer at PIES IT Solution

Responsible for crafting clear, well-structured, and beginner-friendly content across the platform. Handles the writing, proofreading, and editorial review of tutorials, guides, and documentation to ensure every article is accurate, readable, and easy to follow.

Expertise: Technical Writing · Content Creation · Documentation · Editorial Writing · JavaScript · TypeScript · Python · Python Errors · HTTP Errors · MS Excel
 · View all posts by Caren Bautista →

Leave a Comment