I added a function to Object.prototype using Object.prototype.func = function () {...} but when I try to call it using Object.func() it throws an error that it is not defined in Object.
I added a function to Object.prototype using Object.prototype.func = function () {…} but when
Share
Everything in JavaScript is an object and inherits from Object (including Object). If there’s a property on Object.prototype then EVERYTHING can access it because it is in everything’s prototype.
http://jsfiddle.net/PxLDu/1/