1let originalArray = [
2 {name: 'John', age: 23, color: 'red'},
3 {name: 'Ann', age: 21, color: 'blue'},
4 {name: 'Mike', age: 13, color: 'green'}
5];
6
7let filteredArray = originalArray.filter(value => value.age > 18);
1var colors = ["red","blue","car","green"];
2var carIndex = colors.indexOf("car");//get "car" index
3//remove car from the colors array
4colors.splice(carIndex, 1); // colors = ["red","blue","green"]
1var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
2var filtered = array.filter(function(value, index, arr){
3 return value > 5;
4});
5//array => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
6//filtered => [6, 7, 8, 9]