function check(a,b,c,d,e){ return a + b + c + d + e ; } alert(check(true, true, false, false, false)) //2 alert(check(true, true, true, true, true)) //5 alert(check(false, false, false, false, false)) //0
alert([false, false, true, true, true].reduce(function (a, b) {return a + b}, 0));
var arr = [true, false, true, false, false, true, true, false, true].filter(function(value) { return value; }); alert(arr.length);