Skip to content

Instantly share code, notes, and snippets.

@GeoffreyHervet
Created January 25, 2022 11:05

Revisions

  1. GeoffreyHervet created this gist Jan 25, 2022.
    17 changes: 17 additions & 0 deletions test.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    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());
    })