SO - 29383632

by Arun P Johny

JavaScript

var scareMe = function () {
    console.log("Boo!");
    var instance = this,
        proto = scareMe.prototype;
    scareMe = function () {
        console.log("Double Boo!");
        return instance;
    }
    scareMe.prototype = proto;
}
scareMe.prototype.nothing = true;
var un1 = new scareMe();
console.log('nothing', un1.nothing); //true
scareMe.prototype.everything = true;
var un2 = new scareMe();
console.log(un1 === un2); //true
console.log('everything', un1.everything); //true