Created
January 25, 2022 11:05
-
-
Save GeoffreyHervet/1b9883eb8d1c4db8007487d06d4535d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass { | |
constructor(private name: string){} | |
func1 = () => { return this.name; } | |
func2() { | |
return this.name; | |
} | |
} | |
const object = new MyClass('MyName'); | |
console.log(object.func1()); | |
console.log(object.func2()); | |
console.log('~'.repeat(10)); | |
[ object.func1, object.func2 ].forEach(funcToCall => { | |
console.log(funcToCall()); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output