其他分享
首页 > 其他分享> > 判断数组中有几个相同的值

判断数组中有几个相同的值

作者:互联网

let a = [true, false, true, false, false, true, true]
  let b = [false, true, false, false]
  let d = []
  let e = 0
  for (var i = 0; i < a.length; i++) {
    let isSore = true
    if (a[i] == true) {
      isSore = false
      d.push(a[i])
    }
  }
  console.log(d.length);

 

标签:false,log,相同,isSore,中有,length,let,数组,true
来源: https://www.cnblogs.com/zhengwenfang/p/16056997.html