var dump in js code example
Example 1: javascript var dump
//common way
console.log(object);
//for non-browser srcipts
console.log( JSON.stringify(object, null, 2) ); // spacing level = 2
Example 2: jquery var_dump array
function dump(obj) {
var out = '';
for (var i in obj) {
out += i + ": " + obj[i] + "\n";
}
alert(out);
}
Example 3: jquery var_dump array
dump(field.choices[i]);