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

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);

 

posted @ 2022-03-25 22:21  生活在北极的企鹅  阅读(155)  评论(0编辑  收藏  举报