/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//two level object literal var valid = { fName : { req : true, max : 6 }, lName : { req : true, max : 10 } } var fld; //fld is text value of object key for(fld in valid) { console.log(valid[fld].req); } //Will display true true 23