javascript find element in array and remove

JavaScript
var colors = ["red","blue","car","green"];
var carIndex = colors.indexOf("car");//get  "car" index
//remove car from the colors array
colors.splice(carIndex, 1); // colors = ["red","blue","green"]const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}

// array = [2, 9]
console.log(array);let originalArray = [
    {name: 'John', age: 23, color: 'red'}, 
    {name: 'Ann', age: 21, color: 'blue'}, 
    {name: 'Mike', age: 13, color: 'green'}
];

let filteredArray = originalArray.filter(value => value.age > 18);const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}

// array = [2, 9]
console.log(array); var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
var filtered = array.filter(function(value, index, arr){ 
  return value > 5;
});
//array => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
//filtered => [6, 7, 8, 9]
Source

Also in JavaScript: