130
rated 0 times
[
131]
[
1]
/ answers: 1 / hits: 85166
/ 11 Years ago, fri, june 14, 2013, 12:00:00
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};
I could write something like this :
if(myObj.title && myObj.name && myObj.email){
/*Some code */
};
But I am looking for the simplest way to write it. eg :
if(myObj all is true){
/*Some code */
};
I might have another object with 10-20 items inside it, and will need to know if all are true.
More From » javascript