JavaScript – How to remove a particular element from an array

To remove an element from an array. First, we need to find the index of the element you wish to remove.

var array = [100, 200, 300];
var index = array.indexOf(300);

if (index > -1) {
    array.splice(index, 1);


Then remove it with splice()


(2) [100, 200]

Author: Wu Chia Chong

My main areas of interest are software architectures and software design methods, patterns, and new trends in software development.