Sometimes, we want to access class member from a function in method class in TypeScript.
In this article, we’ll look at how to access class member from a function in method class in TypeScript.
How to access class member from a function in method class in TypeScript?
To access class member from a function in method class in TypeScript, we can use the this keyword.
For instance, we write:
class Foo {
  bar() {}
  baz() {
    this.bar()
  }
}
to call the bar method in the Foo by using this.bar as we did in the baz method.
Conclusion
To access class member from a function in method class in TypeScript, we can use the this keyword.
