Hi i am trying to find the sum of Boolean values in the object array in JavaScript
My json like be
var myoBj = [{
\"id\": 1,
\"day\": 1,
\"st
If you must use reduce you can take advantage of the fact that x*false == 0, and so you can do the following:
const myObj=[{id:1,day:1,status:true},{id:2,day:1,status:false},{id:3,day:1,status:false},{id:4,day:3,status:false}],
res = !!myObj.reduce((bool, {status}) => bool*status, true);
console.log(res);