js 数组对照筛选

var list = [{name:'zm',type:[2,3],age:'20'},{name:'dabao',type:[1,2,5],age:'22'}]; var sport = ['篮球','足球','羽毛球','高尔夫','棒球']; console.log(list); console.log(sport);       for(let i = 0;i<list.length;i++){ list[i].dd = []; for(let j = 0;j<list[i].type.length;j++){ console.log(list[i].type[j]); for(let k =0;k<sport.length;k++){ let o = ''; if(sport[k+1] == sport[list[i].type[j]]){ o = sport[k]; list[i].dd.push(o);      } } } }   console.log(list);
上一篇:一个关于勾选框的练习


下一篇:Linux tracepoint分析