以前的代码是必需要五个selectGame.id参数,我就用的最笨的办法,现在的要求是1-10个,
mylotteryList1和selectGame中都有id,相互对应
我之前的思路是只要mylotteryList1中包含有selectGame的id,就把mylotteryList1中的那组数据push进collectionList中
请问如何更改?
for(let j=0;j<this.mylotteryList1.length;j++){
let gid = this.mylotteryList1[j].Id
if(gid==this.selectGame[0].Id||gid==this.selectGame[1].Id||gid==this.selectGame[2].Id||gid==this.selectGame[3].Id||gid==this.selectGame[4].Id){
this.collectionList.push(this.mylotteryList1[j])
}
}
前端都
ES2018
了,那么多美妙直观的语法糖不用,看到这种丑到天际的for j for i
真是无语啊es6一行就行了