0

enter image description here

As you see in the image above, the value of this.

However when I try to access its values like this.swipeCard, the value gets undefined as seen on the next image.

enter image description here

Not sure what's happening but any ideas would be very helpful.

Thanks~

JYR
  • 109
  • 4
  • 15
  • 1
    Could you update your question to include a [mcve]? I'd recommend using a stacksnippet (click `<>` when editing the question). – evolutionxbox Jun 14 '17 at 10:51
  • Adding code instead of screenshot is better. – Nadir Laskar Jun 14 '17 at 10:54
  • 1
    arrow functions [don't bind](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_binding_of_this) `this` - they share the enclosing scope. – Emissary Jun 14 '17 at 10:57
  • Switch back to es5 notation (ie not arrow functions) and it should function as you expect. – rrd Jun 14 '17 at 11:03
  • @rrd Your advice works. I'm contented for now. Emissary It's a good read. Thanks guys. – JYR Jun 14 '17 at 11:22

0 Answers0