剩余数组(从'水果数组'筛选掉'吃了的数组')

fruits = ['香蕉','苹果','梨子','水蜜桃','橘子','橙子'];
eatfruit = ['香蕉','水蜜桃','橘子'];
other = [];

this.other = this.fruits.filter(item => {
   return this.eatfruit.every(item2 => {
          return item != item2;
      });
   }).map((item) => {
       return item;
});

 

posted @ 2019-06-12 13:58  雨夜稻草  阅读(287)  评论(0编辑  收藏  举报