javascript - JS - Check if all an object's own properties are true -


i have object has several fields potentially shifted true user (think list of achievements). if had object {one: true, two: false, three: true}, how able escape execution of function (because not keys true)? have tried far:

for (var key in achis) {     if (achis.hasownproperty(key)) {         if (key === false) {             cb && cb();             return;         }      } } achievements.update({userid: achis.userid}, {$set: {all: true}}, function(err) {     if (err) {         console.log(err);     }     cb && cb();     return; }); 

how able update acheivements doc field "all" true if key values in achis "true" this: {one: true, two: true, three: true}

key gives property name. if want value use archis[key].