Closed aruntk closed 7 years ago
Well, that's the behaviour of arrow functions, no? :) The arrow function's lexical scope in your second example will be bound to the outer, and makes userId
be undefined
.
Correct. From MDN:
An arrow function expression [...] does not bind its own this, arguments, super, or new.target.
this.userId
isundefined
when using arrow function as argument of the publication.