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"]
1 // we have an array of objects, we want to remove one object using only the id property
2var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
3
4// get index of object with id:37
5var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
6
7// remove object
8apps.splice(removeIndex, 1);
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
1let array = [1,2,3];
2let item = array.indexOf(2)
3let deleteCount = 1;
4array.splice(item, deleteCount)