Easily find the contents of a JavaScript Object
November 20, 2012 Leave a comment
Instead of tracing the source of a function and going thourgh it to find the elements of a JavaScript Object, place this function in your code (temporrarily) to see what an Object consists of.
var YOUR_JAVASCRIPT_OBJECT = new Object(); YOUR_JAVASCRIPT_OBJECT.name = 'joe'; YOUR_JAVASCRIPT_OBJECT.age = '95'; //below is the loop which prints the contents of our object //this would be pretty useful if we cannot see the above code var object_params; for (object_params in YOUR_JAVASCRIPT_OBJECT) { alert("Your JavaScript has this property: " + object_params); }