Revision: 48091
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 23, 2011 15:34 by supermauerbros
Initial Code
for (var key in mainObject){ if(key && mainObject.hasOwnProperty(key) && ($.inArray(key, testAgainstThisArray) !== -1 ) && mainObject[key] !== null ) { console.log(key); } }
Initial URL
Initial Description
Returns the key name in mainObject if it's a key, and hasOwnProperty of key (to rule out the prototype object. Then it also checks if the key is listed in an array using a jquery function and also tests if it's null.
Initial Title
Iterate through keys in an object literal and return the key name.
Initial Tags
object
Initial Language
JavaScript