How do I splice my array?
问题 I have a favourites feature, but want the user to be able to remove them. This is what it looks like: So what I want to achieve is a "Remove" link under each item which calls the remove function, and so removes that entity. Here is my JS: function updateFavourite(video) { document.getElementById('favourite').onclick = function () { if ($.grep(myfavourite, function (item) { return item["id"] == video["id"]; }).length == 0) { blacklist[video["id"]] = true; myfavourite.push(video); var html = "