js 动态增加数组

var Filter=[];
if(word!=""){
Filter.push({"fieldname": "log_userid","relationop": "like","word": [{ "itemtype": "c", "value": word }]});
}
if(logtype!="" && logtype!=undefined){
Filter.push({"fieldname": "log_type","relationop": "like","word": [{ "itemtype": "c", "value": logtype }]});

}

console.log(Filter);

你可能感兴趣的:(前端js)