Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140817

how to call back functions without the error "Maximum call stack size exceeded" in javascript [duplicate]

$
0
0

I'm trying to code a game, to do this I need to recall functions until the players lose.

Just something like this.

class Game{

    init(){
        //init game
        if(!this.gameOver())
            this.lunch();
    }
    lunch(){
        //init pieces of the game 
        this.refreshCanvas();
    }
    refreshCanvas(){
        //refreshing frames of the game
        if(!this.isFloorTouched()){
            this.lunch(); // ---> When i do this nothing work anymore "Maximum call stack size exceeded"
        }
    }

}

Viewing all articles
Browse latest Browse all 140817

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>