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"]
1const array = [1, 2, 3];
2const index = array.indexOf(2);
3if (index > -1) {
4 array.splice(index, 1);
5}
1var months = [
2 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
3 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
4 ];