Answer: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”;


// or, if you wanted to avoid alerts…

var pre = document.createElement(‘pre’);
pre.innerHTML = out;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.