web technology is a way of life
5 Jan
Here’s a great little bit of code that I’ve come to rely on when wanting to easily check out an object in JavaScript. I tend to like having my own trace windows especially when needing to debug code in old browsers like IE 6 or when using IE for debugging Facebook tabs and apps. I found this code on github.
var toJSON = function f(a,b,c){for(b in(c=a==""+{}&&[])&&a)c.push(f(b)+":"+f(a[b]));return""+a===a?'"'+a+'"':a&&a.map?"["+a.map(f)+"]":c?"{"+c+"}":a};
Then simply call and alert() or whatever trace function you would use and pass in your object like so
alert(toJSON(myObj));