remove form array js code example
Example 1: remove a particular element from array
var colors = ["red","blue","car","green"];
var carIndex = colors.indexOf("car");
colors.splice(carIndex, 1);
Example 2: remove an element from array
var colors = ["red", "blue", "car","green"];
colors = colors.filter(data => data != "car");
colors = colors.filter(function(data) { return data != "car"});
Example 3: remove from array javascript
let numbers = [1,2,3,4]
let last_num = numbers.pop();
let first_num = numbers.shift();
let number_index = 1
let index_num = numbers.splice(number_index,1);