Arrow functions - they're the more concise version of regular functions and they've been gaining popularity since they were first introduced in ES6...
For further actions, you may consider blocking this person and/or reporting abuse
The lexically bound
thiscontext is probably the most important quality of thicc arrow functions.Agreed. It helps with some of the strange and unexpected behavior of
this.Being a react developer, I mostly use arrow functions to bind this context
You are not binding the context by using an arrow function, it doesn't work that way.
More info here: github.com/getify/You-Dont-Know-JS...
I tend to use hooks in new code and avoid
thisaltogether.Can you please provide an example of this (using hooks not
this).Implicit return:
When returning an Object, remember to wrap the curly brackets in parentheses to avoid it being considered the default wrapping function body brackets:
And remember to write tests so you catch these mistakes :)
We wish to read you about tests - from scratch - if you have time to start a serie about that topic... ;)
When I first saw the Title and I thought it is going to be something strange but it came out as the Lambda Functions that is being used in the Higher Versions of Java, by the way as I am a JavaScript Developer as well so it is very nice post according to that as well :)
The arrow function is by definition a lambda function, is not just syntax.
Concise and easy to understand, love learning little new bits and pieces about JS!
The
thiskeyword has shortened my coding time by a lot in my recent projects.Thank you!
Great post! Also really appreciate the link to a deeper insight of how the keyword works with arrow functions.👌
Nice post! Truly helpful as I never took the time to truly master the arrow function
A nice quick read with usefull information. I didn't know it does an implicit return. I'm still not sure how
thisworks, but I'll look that up.Thanks!
Thank you!
Hi Kara I think there's a missing
constin the very first snippet :-)Ah thank you! I meant to get rid of setting that variable at all actually.
Arrow functions make more sense to me know that I know about hashes in Ruby 🤔
How do we write a return type in an arrow function?
Nice write up, Kara.
Thank you!