But as time has passed, the world has changed, and so have I. Is it still a good idea to lean on this technique to squeeze more expressivity out of your code?
But arrow functions are much more than function expressions with a fresh coat of paint. On top of the new appearance, there are some significant differences in the way they behave too.
This post explores these new behaviours; including why arrow functions don’t have their own values for thisorarguments, and what that means for the code you write.
I’m a programmer who uses functions like a preschooler uses glitter, so arrow functions is one of the features I’m really excited about. Here’s what I’ve learnt from reading the specification, reading forum discussions and testing things out in the Babel playground.
A programmer’s pipe-dream is to write code, and be able to use it repeatedly with little effort. It’s expressive because you write in a way that expresses what is needed, and it’s reuse because.. well, you’re reusing. What more could you want?
Compare these two solutions for returning the name of all the audiophiles in a contact book: