Is there a way in javascript to make the runtime use a different object representation in the error messages.
A typical error message
Uncaught TypeError: Object [object Object] has no method 'toggle'
It would be helpful if we can give a better representation to the object than [object Object]
.In other languages you can make it print a better representation of the object by overriding toString()
.
However it looks like overriding toString has no effect in this case.