Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140734

How to access a class variable inside a closure in nodejs?

$
0
0
class A {
  constructor() {
    this.a = ""
  }
  run() {
    b.on("event", function(data) {
      // how to access variable a here?
    })
  }
}

how to access a class variable inside a closure?


Viewing all articles
Browse latest Browse all 140734

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>