Arrow Functions and `this`
Learn how arrow functions interact with the `this` keyword. Learn how we can leverage their new rules of 'this' binding to make our code more intuitive and clean.
We'll cover the following
Arrow functions and this
Arrow functions don’t follow any of the traditional rules of this
-binding.
Instead, arrow functions get their this
binding from their scope. We’ve discussed five rules to this
-binding. We can now add a 6th. Here they all are.
Rules
1 - If the new
keyword is used when calling the function, this
inside the function is a brand new object.
Get hands-on with 1400+ tech skills courses.