SHARE
TWEET

Untitled

a guest Dec 7th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let a = [
  2.   {id:1, failcheck:2},
  3.   {id:2, failcheck:1}
  4. ]
  5.  
  6. let count = a.reduce((count, item) => {
  7.   return {[item.failcheck]: item.failcheck in count ? count[item.failcheck] + 1 : 1}
  8. },{})
  9.  
  10. console.log(count)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top