我有一个要过滤的对象。这就是我使用的:
query = {
"teststring-123": "true",
"teststring-12344566": "false",
test: "true"
}
我想过滤查询,以便过滤后我只有:
query = {
"teststring-123": "true",
"teststring-12344566": "false"
}
$(query).each(function(index, value) {
$.each(value, function(i, v) {
if(i.indexOf('teststring-')==-1) {
// remove part of query object where index is this one
console.log(index)
}
});
});
我该如何处理?