Fork me on GitHub

vue中filter的用法

  test() {
     var arr1 = ["A", "B", "C","C","A"];
      var rq=arr1.filter(function(x,index,self){
        return self.indexOf(x) == index;
      })
      console.log(rq.toString())
      var arr = ["A", "", "B", null, undefined, "C", "  "];
      var r = arr.filter(function(s) {
        return s && s.trim(); 
      });
      console.log(r)
    }

详情请见:http://www.cnblogs.com/cjx-work/p/8052865.html

posted @ 2019-02-12 17:21  欢欢11  阅读(1345)  评论(0编辑  收藏  举报