assigning class method to variables

It works!

by David Gonzalez

JavaScript

class TestLocalFunctionOFClassMethod{
	constructor(){

	}
  aMethod(text){
  	return text;
  }
  anotherMethod(){
  	let aMethodReference = this.aMethod;
    return aMethodReference("Yes!");
  }
}
let obj = new TestLocalFunctionOFClassMethod();
console.log(obj.anotherMethod()); // it works!