Help with error in Ping Pong game [closed]

1

At this moment I am programming a game of Ping Pong and I am supporting myself in a tutorial to do it. The question is that I have an error of the type:

Uncaught SyntaxError: Missing initializer in const declaration

and I can not find any solution

const callback  (millis) => {
        if (lastTime) {
            this.update( (millis - lastTime) / 1000 );
        }
        lastTime = millis;
        requestAnimationFrame(callback);
    };
    
asked by Arturo Pérez 31.03.2017 в 03:38
source

1 answer

3

If you notice the error, it says that you can not find an initializer for the constant callback because you lack the equal sign. Deal with this.

const callback = (millis) => {
    if (lastTime) {
        this.update( (millis - lastTime) / 1000 );
    }
    lastTime = millis;
    requestAnimationFrame(callback);
};
    
answered by 31.03.2017 в 04:21