1function func() {
2 this.var = 5;
3
4 this.changeVar = function() {
5 setTimeout(() => { //Don't use function, use arrow function so 'this' refers to 'func' and not window
6 this.var = 10;
7 }, 1000);
8 }
9}
10
11var a = new func();
12a.changeVar();