Awesome post! I have to make the subtle point of the performance difference when you use certain approaches though.
let multipliedByTwo = arr.map((el) => timesTwo(el));
vs.
let multipliedByTwo = arr.map((el) => timesTwo);
creates extra unnecessary function around a function. It can be more of a hit when you nest function definitions inside of a callback, but that's a subject for a different post altogether! Great work here!
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
Absolutely true. And given that I was trying to show identical code I struggled over whether to include that one. Thanks for noting it. I likely should have of the original post!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Awesome post! I have to make the subtle point of the performance difference when you use certain approaches though.
let multipliedByTwo = arr.map((el) => timesTwo(el));
vs.
let multipliedByTwo = arr.map((el) => timesTwo);
creates extra unnecessary function around a function. It can be more of a hit when you nest function definitions inside of a callback, but that's a subject for a different post altogether! Great work here!
Absolutely true. And given that I was trying to show identical code I struggled over whether to include that one. Thanks for noting it. I likely should have of the original post!