This article is kinda like a big if (…) … else if (…), so you can go straight to the first section that matches the code you're looking at. If the function is defined as an arrow function, the value of this is always the same as this in the parent scope. This pattern is really useful when using instance methods as event listeners in components (such as React components, or web components)

Post cover image
Table of contents
If the function is defined as an arrow function: #Otherwise, if the function/class is called withOtherwise, if the function has a 'bound'Otherwise, ifOtherwise, if the function is called via a parent object (

Sort: