var f; var filteredElements = data.filter(function(item, index) { f = index; return item.id == removeId; }); if (!filteredElements.length) { return false; } data.splice(f, 1);