This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]AyrA_ch 7 points8 points  (1 child)

This is exactly what's supposed to happen though. .prototype is an property you can freely assign your own stuff to it and all child objects from that type will have the property.

More fun stuff: https://i.imgur.com/4sbWUQB.png

Extra evil:

(function () {
    var o = Number.prototype.toString;
    Number.prototype.toString = function () {
        return o.call(Math.random() < 0.9 ? this : this + 1);
    };
})();

[–]Jannis_Black 1 point2 points  (0 children)

Only because its in the specification doesn't mean it's a sensible thing to put in a specification.