Am learning Javascript and trying to run some code to increase my understanding of using classes. Please find my code and comment on the last line for the assistance I need.
class MyApp {
constructor(name) {
this.name = name
}
getName() { return `${this.name}` }
}
const me = new MyApp("Prosper");
console.log(me.getName); // function getName() {...}
const func = (callback) => console.log(me.callback());
func(me.getName); // Why not printing "Prosper" here?
But I expected since callback is a parameter and I passed me.getName as an argument which is a function that exists in the me object’s prototype when I called func, it would resolve to