array remove num code example
Example 1: js remove from array by value
const index = array.indexOf(item);
if (index !== -1) array.splice(index, 1);
Example 2: javascript remove element from array
const cars = ['farrari', 'Ice Cream'/* It is not an car */, 'tata', 'BMW']
//to remove a specific element
cars.splice(colors.indexOf('Ice Cream'), 1);
//to remove the last element
cars.pop();