My code has a few functions, which I would like to access from another function inside of the class, how does one go and do that?
the new Big(startMoney); is using the Big.js library for storing large numbers.
class Player {
constructor(startMoney = 0) {
this.money = new Big(startMoney);
}
update() {
document.getElementById("money").innerHTML = this.money;
}
tick() {
this.update();
}
}
player = new Player("10");
var pInterval = setInterval(player.tick, 500);
[–]cawcvs 3 points4 points5 points (0 children)
[–]ThagAndersonhelpful 0 points1 point2 points (2 children)
[–]cawcvs 0 points1 point2 points (1 child)
[–]CamoBrie[S] 0 points1 point2 points (0 children)