let Test = function() {
let i = 0;
return {
inc() {
i++;
},
cur() {
return i;
}
};
};
let myTest1 = Test();
myTest1.inc();
console.log(myTest1.cur());
myTest1.inc();
console.log(myTest1.cur());
myTest1.inc();
console.log(myTest1.cur());
let myTest2 = Test();
myTest2.inc();
console.log(myTest2.cur());
//Вот этот способ не работает. Почему?
//Test().inc();
//Test().inc();
//Test().inc();
//console.log(Test().cur());