It is possible. You can to use Object.prototype.toString (reference in this link):
function MyObject () {
this.numProperty = 1;
this.strProperty = "some string";
}
MyObject.prototype.toString = function (){
return this.strProperty;
}
// example usage:
var obj = new MyObject();
document.getElementById("x").innerHTML = obj;
EDIT:
for console.log behavior you can use either
console.log(obj.toString());
or
Console.prototype.logO = function (obj) {
this.log(obj.toString());
}
// and then
console.logO(obj);
The last line is what you wanted in the first place, but I would go for the first option as it's less wordy.
Here's a JSFiddle.
new Date2()new Date()does not return a string. It's just the console that formatsDateobjects as such.