Often when coding complex javascript you’ll wish you had the ability to debug objects or arrays that you are working on – much like Data::Dumper in Perl or var_dump in php (see previous posts on these topics). Prototype.js provides an easy way to do this using the .inspect() method for hashes and arrays:

var myComplexHash = {Element: value, AnotherElement: value2 ... };

alert($H(myComplexHash).inspect());

The $H(myhash).inspect() function returns a debug-oriented string which can be easily deciphered:

<#Hash:{Element: 'value', AnotherElement: 'value2', ... >