If you want to write your JavaScript code in a better way, one of the most effective techniques is functional programming (FP). It's no difficult t...
For further actions, you may consider blocking this person and/or reporting abuse
For loops are faster than map, filter, and reduce. They always will be since they don't have the overhead of call backs. Correct your post at the beginning
"it's faster than the other version" needs to be removed
You are correct, Thanks. I have updated the article to reflect the same and added a footnote for performance.
Why
const square = power.bind(null, 2)
overconst square = num => power(2, num)
?I believe they are doing the same thing.
bind()
offers a built-in solution for writing a wrapper function, but with the added advantage of passing context as the first argument (which I haven't used here).Functional Programming every time, all the time baby. 💯💯💯
One note:
function calculateArea = (radius) => 3.14 * radious * radius;
is not valid javascriptThanks, corrected!