0

The following piece of code screams due to this being undefined.

function myFunc(f) {
  console.log(f());
}

class Test {
  potato = "potato";

  test() {
    return this.potato;
  }
}

const t = new Test();
myFunc(t.test);

How can I overcome this issue?

David
  • 208,112
  • 36
  • 198
  • 279

0 Answers0