Say in JavaScript I create a simple object:
function MyObj() {
this.prop = \"property\";
}
Now if I create an instance of this and the
You could hook the browser console, and redefine it afterwards:
var obj = {
name: "Joel",
age: 32,
toString: function() {
return this.name + " is " + this.age + " years old.";
}
};
var browserConsole = console;
console = {
log: function(data) {
if (typeof data === "object") {
browserConsole.log(data.toString());
} else {
browserConsole.log(data);
}
}
}
console.log(obj);