I've been working on a JavaScript function in ES5 that is designed to take an array, filter it, and then assign the original array with the filtered results.
If you'd like to check out my progress so far, feel free to visit my plunk here.
Here is a rough outline of what I'm attempting to achieve:
var result = [{ 'date': '20171116' }, { 'date': '20171115' }];
var data = { 'date': '2017116' };
deleteEntry(data, result);
console.log(result); // should have one entry
function deleteEntry(data, result) {
result = result.filter(function(item) {
return item.date !== data.date;
});
}
I suspect that the issue lies within how arrays are referenced. If anyone has any insights on how to tackle this problem, I would greatly appreciate it.