Message from JavaScript discussions

April 2019

— Right away...

— 

Class Game {
constructor(pace, money){
this.hour = (a) =>{
a = Math.floor(this.startTime/60)
return (a > 23) ?a = 0 :a
};
this.minute = (a) => {
a = this.startTime%60
return (a < 10) ?'0'+a :a }
this.startTime = 464;
this.pace = pace;
this.money = money; //12
this.interval = null;
this.process = null;
}
displayTime(){
return this.hour() +':'+this.minute()
}
ticking(){
return this.startTime++
}
play(func){
this.interval = setInterval(()=>{
console.log(this.displayTime());
console.log(func);
this.startTime++;
return this.startTime}, 1000)
}
pause(){
return clearInterval(this.interval)
}

}

const newGame = new Game(1000, 10000);
const test =()=>newGame.pause()
setTimeout(test, 8000)

newGame.play(newGame.startTime)

— This code generates a fake time and when you call newGame.play() it shows everything well

— But when you check the new game.startTime it doesn't update

— So what do you think?

— Or is it impossible to change a value of an object's property by calling the same object's method??

— There are 1100 coders in this group and nobody can help

— I am starting to create one new project in nodejs which framework i have to use

— Express ?

— Now that's called spamming. admins

— I need to use express generator?

— ExpressJS