In JavaScript, I need to know if all object items are set to true.
If I have the following object:
var myObj = {title:true, name:true, email:false};
In modern browsers:
var allTrue = Object.keys(myObj).every(function(k){ return myObj[k] });
A shorter alternative to this is:
var allTrue = myObj.every(function(i) { return i; });
If you really want to check for true
rather than just a truthy value:
var allTrue = Object.keys(myObj).every(function(k){ return myObj[k] === true });