I'm setting a variable in the constructor and I can't access it from one of the methods as "this" refers to the function (it shouldn't be the case). Here's what it looks likecode:
class myClass {
constructor(variable) {
this.variable = variable;
}
test(packet, next) {
console.log(this.variable)
}
}
I'm using VS 2017 in case that matters.
via aslad
No comments:
Post a Comment