class C { constructor() { this.num = Math.random(); } rand() { console.log("Random:" + this.num); } } var c1 = new C(); c1.rand(); C.prototype.rand = function () { console.log("Random: " + Math.random(this.num * 1000)); }; var c2 = new C(); c2.rand(); c1.rand();