I would solve this by making a "deep copy" of what you are registering and passing the copy to console.dir (). Something like this works very well:
function deep_copy(ref) { var r; var i; if(isHash(ref)) { r = {}; for(i in ref) r[i] = deep_copy(ref[i]); } else if(isArray(ref)) { r = []; for(i = 0; i < ref.length; i++) r[i] = deep_copy(ref[i]); } else { r = ref; } return r; }
If you do not want to worry about something like that, then using JSON.stringify is a great workaround and will not be much slower if it is native in the browser.
console.dir(JSON.parse(JSON.stringify(o));
source share