How to get count of elements matching a predicate in a javascript array?

后端 未结 0 1077
时光说笑
时光说笑 2020-12-19 07:07

Let\'s say we want to count the NaN\'s in a javascript array. We can use

let arr = [...Array(100)].map( (a,i) => i %10==0 ?  NaN : i )
consol         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题