splice is es6 code example
Example: splice javascritp
let colors = ['red', 'blue', 'green'];
let index_element_to_be_delete = colors.indexOf('green');
colors.splice(index_element_to_be_delete);
//Colors now: ['red', 'blue']
let colors = ['red', 'blue', 'green'];
let index_element_to_be_delete = colors.indexOf('green');
colors.splice(index_element_to_be_delete);
//Colors now: ['red', 'blue']