我有項目的功能如下: 我有一個二維數組,然後應該刪除特定的一維數組。 二維數組爲:如何從二維數組中刪除特定的一維數組?
//ID,Name,Age,Score.Student的ID是唯一的。
var arr1=[["1","aaa","20","90"],
["2","bbb","21","80"],
["3","ccc","22","70"],
["4","ddd","23","60"],
];
var arr2=["3","ccc","22","70"];
我想要得到的二維array.The結果如下:
result=arr1=[["1","aaa","20","90"],
["2","bbb","21","80"],
["4","ddd","23","60"],
];
我寫一些代碼,但我得到一個邏輯的jsfiddle的和error.The網址是:Edit fiddle
非常感謝。
根據您的演示,您使用下劃線,對不對? – Pavlo
只是一個提示:如果您的ID是唯一的,使用字典/對象:它會更快找到/添加/刪除新項目。 – MarcoL
@MarcoCI我的同事也建議我使用該對象,然後實現這個對象的添加或刪除方法。我會盡力做到這一點。謝謝 –