Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo {
- constructor() {
- this.func = null;
- }
- a() {
- let self = this;
- this.func = function() {
- console.log(self);
- console.log(this);
- }
- let testFunc = function() {
- console.log('in test func')
- console.log(this);
- }
- testFunc();
- }
- b() {
- console.log('in b')
- this.func();
- }
- }
- let x = new Foo();
- x.a();
- x.b();
Add Comment
Please, Sign In to add comment