Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHarris Keka
Courses Plus Student 3,611 PointsThe "This" Keyword with Arrow and Normal Fuction
While using the 'this' keyword on my methods, With arrow functions I'm not able to access object properties from within the method. But when I use the this keyword with a normal function I am able to access the object properties.
Can someone try to give what is precise with arrow functions and the 'this' keyword?
2 Answers
Steven Parker
231,269 PointsAs you have discovered, arrow functions don't establish "this" as conventional functions do, so they are not always a suitable replacement.
There are other differences as well, for complete details on them all see this MDN page on Arrow function expressions.
Harris Keka
Courses Plus Student 3,611 PointsThanks Steven.
Harris Keka
Courses Plus Student 3,611 PointsThat was unintentional Steven.
Thanks for the heads-up.