Getting this as undefined when using arrow function

前端 未结 2 548
面向向阳花
面向向阳花 2020-11-28 15:36

I\'m using arrow functions and I\'m debugging with Chrome and Firefox Dev Tool. I am getting, this as undefined, even though the code still works.

My a

2条回答
  •  情书的邮戳
    2020-11-28 16:19

    This might be an issue because JS arrow functions don't have this, the value of this might be referencing the object containing your arrow function, per Arrow functions revisited and MDN's article on Arrow function expressions

提交回复
热议问题