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 id = 88;
2
3for(var i = 0; i < data.length; i++) {
4 if(data[i].id == id) {
5 data.splice(i, 1);
6 break;
7 }
8}
9
1//using filter method
2let itemsToBeRemoved = ["Sunday", "Monday"]
3var filteredArray = myArray.filter(item => !itemsToBeRemoved.includes(item))
1//1
2someArray.shift(); // first element removed
3//2
4someArray = someArray.slice(1); // first element removed
5//3
6someArray.splice(0, 1); // first element removed
7//4
8someArray.pop(); // last element removed
9//5
10someArray = someArray.slice(0, a.length - 1); // last element removed
11//6
12someArray.length = someArray.length - 1; // last element removed