裏面我使用underscore.js插件這是我的代碼
我想在這裏jsfiddle如何篩選重複的對象數組
var basket=[{
"basketitems":[{"items":[]}],
"itemdetails":[{
"amountPledged": "100",
"bActivity": "Handloom Work",
"bCity": "Nadia"
},
{
"amountPledged": "100",
"bActivity": "Saree Business",
"bCity": "Nadia"
},
{
"amountPledged": "100",
"bActivity": "Saree Business",
"bCity": "Nadia"
}],
"cartdetails":[],
"paymentdetails":[],
"userdetails":[]
}];
var tempbasket=_.uniq(basket);
document.body.innerHTML = JSON.stringify(tempbasket);
幫我解決這個問題
有沒有辦法通過itemdetails對象內的關鍵[CityName]過濾? –