我有一个名为AllLinks的共享点列,其中我将数组存储为:
[{"AllLinks":"Link9","LinkURL":"http://www.Link9.com"},
{"AllLinks":"Link6","LinkURL":"http://www.Link6.com"}]
Run Code Online (Sandbox Code Playgroud)
如何检查对象数组中是否存在值以及是否找到匹配项,请删除键值对。
例如,如果值Link6匹配,则使用javascript / jquery从数组中完全删除条目。我尝试过:
var newA = data.d.results.filter(function (item) return item.AllLinks !== x;});
Run Code Online (Sandbox Code Playgroud)
但item.AllLinks再次返回完整的数组本身
因为AllLinks是我的共享点列表中的一列。