I manage amazing people here at Bloomberg. Sometimes I even write code. And when I do, I write it in TypeScript! Opinions are my own.

London
Joined October 2019
Replying to @lou_flan
I agree 😁
1
2
Ah, it's not being as smart as I thought. It took the type from the lambda because the return type was invariant wrt the bound array.
1
The answer is that the reduce version is over 50 times slower. Consider the following code which is effectively equivalent and has similar performance. Every call to the function in the loop causes a new object to be created and the properties copied over.
I love to use reduce to write functional #javascript, but using the spread operator is slow! How slow is this ? const uniq1 = (arr) => arr.reduce((p,c) => ({...p, [c]:0}), {}) const uniq2 = (arr) => { const res = {} arr.forEach(el => { res[el] = 0}) return res }
33%uniq1 takes 2x longer
33%uniq1 takes 10x longer
33%uniq1 takes 50x longer
9 votes • Final results
1
2
#sourdough top tips 😉
You’re unable to view this Post because this account owner limits who can view their Posts. Learn more
3
3
Replying to @ceejbot
I do hope you did this watching Sarah Cooper youtube.com/watch?v=j8oaaP68…
Replying to @JohnKennedyEsq
Barely recognized you!
I recommend this one. Not for sale as at some point I need to return it to the library I 'borrowed' it from in 1983 😏
This fabulous presentation by @whereistanya really resonates with me. I once had a role where I did a lot of glue work to get the project delivered just to be told at the end of year I had not written enough code! Great career advice youtube.com/watch?v=KClAPipn…
1
1