Skip to content

Instantly share code, notes, and snippets.

@cdmo
Created August 2, 2012 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdmo/3240384 to your computer and use it in GitHub Desktop.
Save cdmo/3240384 to your computer and use it in GitHub Desktop.
var dump in js
//credit http://stackoverflow.com/questions/323517/is-there-an-equivalent-for-var-dump-php-in-javascript
function dump(obj) {
var out = '';
for (var i in obj) {
out += i + ": " + obj[i] + "\n";
}
alert(out);
// or, if you wanted to avoid alerts...
var pre = document.createElement('pre');
pre.innerHTML = out;
document.body.appendChild(pre)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment