1//removing element by ID
2var element = document.getElementById("myElementID");
3 element.parentNode.removeChild(element);
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"]