When i call the listen method for my application in express, i provided it a callback method for debugging but it gives me an undefined error. Not sure why. I don't like using anonymous function syntax so i wrote a separate function. Yet i get:
ReferenceError: onListenCallBack is not defined
My two functions are inside a class:
init() {
this.#app.listen(this.#port, onListenCallBack);
}
onListenCallBack() {
console.log("Listening on port : " + this.#app.port);
}
Why does it not work when written this way?