I've got two functions, each with a variable called s (In this case). When I instantiate one function it's fine, but when I instantiate the other one right after, the second one overrides the first's s.
Code:
t1 = function(){
    s = 2;
    Object.defineProperty(this, "test", {
        value: function(){
            console.log(s);
        },
        configurable: false
    });
}
t2 = function(){
    s = 42;
    Object.defineProperty(this, "test", {
        value: function(){
            console.log(s);
        },
        configurable: false
    });
}
var t = new t1()
t.test(); // 2
var y = new t2();
y.test(); // 42
t.test(); // 42
Why is this, and how can I fix it?
 
     
     
    