15.2.4.2 Object.prototype.toString()

2010-07-04

string Object.prototype.toString()

Attempt to convert this object to a string. Will basically return "[object "+O.[[Class]]+"]".

The this value will be coerced to an Object.

Code: (Meta Ecma)
Object.prototype.toString = function(){
var O = ToObject(this);
var clss = O.[[Class]]; // not var class ;)
return "[object "+clss+"]";
}