I must have some misunderstanding of objects and the prototype pattern in JavaScript, but I can not understand why the following code does not work:
Object.prototype.log = function() {
console.log(this);
return this;
}
var test = { 'foo' : 'bar'};
test.log();
Why does this throw an object has no method 'log' error?
This should work according to spec. I pasted your code as is into IE10 and it works fine.