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 :)
Concise and easy to understand, love learning little new bits and pieces about JS!
The this keyword has shortened my coding time by a lot in my recent projects.
I'm a web developer and father from The Netherlands. I mostly do Frontend Web development, but I'm also known to dabble in PHP, MySQL and AWS. I'm interested in learning Vue and NodeJS.
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!
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.
Great post! Also really appreciate the link to a deeper insight of how the keyword works with arrow functions.👌
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!
Nice post! Truly helpful as I never took the time to truly master the arrow function
How do we write a return type in an arrow function?
Arrow functions make more sense to me know that I know about hashes in Ruby 🤔
Nice write up, Kara.
Thank you!