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”;
}

alert(out);

// or, if you wanted to avoid alerts…

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

http://stackoverflow.com/a/323809