Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. let a = [
  3.   {id:1, failcheck:2},
  4.   {id:2, failcheck:1}
  5. ]
  6.  
  7. let count = a.reduce((count, item) => {
  8.   return {...count, [item.failcheck]: item.failcheck in count ? count[item.failcheck] + 1 : 1}
  9. },{})
  10.  
  11. console.log(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement