I am trying to use a class function as an argument in another methods. But I keep on getting function not defined when trying to do so. Below is how my class looks like:
class Test{
constructor(name){
this.name = name;
}
functionA(){
console.log('My name is John');
}
functionB(){
console.log('My name is Steve');
}
}
function caller(args){
let test = new Test('t1');
return test.args;
}
caller(functionA())
I am not sure what to do here. Any help is appreciated. Thanks