A lot of times I see explanations of concepts in X language that, while I get what they do, I think "where the hell I can use that?".
Or some other...
For further actions, you may consider blocking this person and/or reporting abuse
Wow, I'm a full-time JavaScript developer and I am familiar with currying, if I'm being honest it's something I picked up when I was studying for interviews.
I recall seeing the double arrow function once and not making the connection that it was a curried function.
It's pretty wild to make that connection now.
Hi! Yes I know, that's what I would normally do, but I feel that with the limited width of dev.to pages, using the
return
makes it a bit more readable ;-)But yeah, in my normal coding I would do as you suggested
Thanks for this awesome blog.
I wanted to know why
**filtering**
function does not**look up**
in its parent scope where name is present.Thank you so much for putting this into a practical application! Much easier to read and understand.
Hey Alessio ,Nicley Explained
But a query🤔
`const filtering = item =>{console.log(name); item.name !== name?true:false;
const filterByName = (list, name) => {
return list.filter(filtering);
}`
name variable in above example is compared with empty string ? shouldnt be the undefined it must be comparing
i have logged its printing an empty string
Thanks for the article, when learning a new concept there are times when people think like 'okay it looks cool but where/when should I use it' currying is probably one of the top concepts when it comes to this.
I remember thinking of a useful usage case to add to my article that's explaining currying, months ago. I'll bookmark yours and show people when I talk about it next time!
This is a solid tutorial, Alessio!
Would you be interested in writing some tutorials for our companies? Happy to pay!
You can either DM me on twitter at twitter.com/AndrewPierno or fill out this little airtable form airtable.com/shrN6S3NMZ7oxRXTt.
I was wondering the example which you shared is not practical too.
the first function itself seems to be concise and DRY. Why make it complicated using currying ? 🤔
const filterByName = (list, name) => {
return list.filter(item => item.name !== name);
}
console.log(filterByName(list, 'John'));
Good one. Thank you for sharing.
Now I get why you'd use currying, thank you.
Great example, thanks!
Best explanation