I currently have a variable that contains an array of numbers
let numbersArray = [12, 15, 19, 20];
When looping over it I want to delete the entry if it is a certain value
let numbersArray = [12,15,19,20],
filteredNumbersArray = numbersArray.map(function(value)
{
if(value === 15)
{
//delete the value
} else {
return value * 2;
}
});
In regards to using .filter(), the value must be mutatable, I have updated the example
I have searched through MDN but couldn't find anything about removing an element within a map().
The Rubber Duck didn't help either
Array#filtercan remove an item,Array#mapreturns a value for each item.