Easily find the contents of a JavaScript Object

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);
       }
javascript object contents

The Romford Pele always knew what his JavaScript Objects contained.


					
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: