Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let a = [
- {id:1, failcheck:2},
- {id:2, failcheck:1}
- ]
- let count = a.reduce((count, item) => {
- return {...count, [item.failcheck]: item.failcheck in count ? count[item.failcheck] + 1 : 1}
- },{})
- console.log(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement