Skip to main content

IMPORTANT - Product End of Life Statement - IMPORTANT

Request RE, Survey, and Calendar 1.5 Support Ending December 31, 2020
Contact Kinetic Data Support with Questions
Kinetic Community

Debugging - YAHOO.lang.dump

Sometimes you need to view the contents of an array or hash (javascript object), but the typical alert(myobj) statement isn't too helpful because it just indicates if the object exists or not.
 
Here is what the following alert statement will generate:
 
var myobj = { name: 'Jack', department: 'Product Development' };
alert(myobj);

 

alert.jpg

 

That isn't very helpful.

 
 
The YUI library has a built in function that will dump the contents of complex objects, making it very easy to see the data of virtually any variable or property you have.  Here is what the alert statement will generate after running the object through the YUI dump function:
 
var myobj = { name: 'Jack', department: 'Product Development' };
alert(YAHOO.lang.dump(myobj));

 

dump.jpg

That gives a lot more information, and should help when troubleshooting code problems.