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"]
1let array = [1, 2, 6, 4, 5, 6, 7];
2
3array = array.filter(element => element !== 6); // [1,2,4,5,7]
1var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
2var removed = arr.splice(2,2);
3/*
4removed === [3, 4]
5arr === [1, 2, 5, 6, 7, 8, 9, 0]
6*/
1//using filter method
2let itemsToBeRemoved = ["Sunday", "Monday"]
3var filteredArray = myArray.filter(item => !itemsToBeRemoved.includes(item))
1var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
2newArr.splice(1,2)
3//remove 1 element from index 2
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//filtered => [6, 7, 8, 9]
6//array => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]