Last active
June 21, 2018 18:42
-
-
Save dtoki/0895111da239c8f28e7f0e8f5dc96940 to your computer and use it in GitHub Desktop.
Local this debug scope undefined in vs code
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 Automobile { | |
constructor(type, year, mph) { | |
this.type = type; | |
this.year = year; | |
this.mph = mph; | |
Automobile.staticMethod(() => { | |
console.log(this); | |
this.nonStaticMethod(); | |
}); | |
} | |
static staticMethod(callback) { | |
console.log('in static method'); | |
console.log(this); | |
callback(true); | |
} | |
nonStaticMethod() { | |
console.log('in non static method'); | |
console.log(this); | |
const foo = () => { | |
const bar = this; | |
console.log(bar); | |
}; | |
foo(); | |
} | |
} | |
const car = new Automobile('suv', 2012, 200); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment