JavaScript:二次元配列からある要素を削除します.

926 ワード

var aqiData = [
["  ", 90],
["  ", 50],
["  ", 10],
["  ", 50],
["  ", 90],
["  ", 100]
];

         ,

var city="  ";

 var newData = aqiData.filter(function(item) {
return item[0] != city;
});

aqiData = newData;
くりを一つあげる
for (let i = 0; i < this.tableItemsData.length; i++) {
                        if (index == i && i > 0) {
                            this.tableItemsData.splice(i, 1);
                        }
                    }
var aqiData = [
        {"ItemNo": '011110030001', "ItemSubNo": 'aaa', "ItemName": 'vv'}
    ];

    var city = "ItemNo";
    var newData = aqiData.filter(function (item) {
        delete item['ItemNo']
        return item;
    });
    aqiData = newData;
    console.dir(aqiData);