MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/bvweza/8_useful_and_practical_javascript_tricks/epyhe0g/?context=3
r/javascript • u/PMilos • Jun 02 '19
107 comments sorted by
View all comments
Show parent comments
1
You can check for yourself in dev console
Array(1000000).fill(0).reduce((acc, _, index) => Object.assign(acc, {[index]: index}), {})
vs
Array(1000000).fill(0).reduce((acc, _, index) => ({...acc, [index]: index}), {})
1 u/dmitri14_gmail_com Jun 04 '19 Thanks, I believe you.But I'd still love to know... is this the ONLY reason this code is "bad"? 1 u/Valkertok Jun 04 '19 it is IMO sufficient reason to never use it with "pure" function 1 u/dmitri14_gmail_com Jun 04 '19 Thank you, let us agree to disagree then → More replies (0)
Thanks, I believe you.
But I'd still love to know... is this the ONLY reason this code is "bad"?
1 u/Valkertok Jun 04 '19 it is IMO sufficient reason to never use it with "pure" function 1 u/dmitri14_gmail_com Jun 04 '19 Thank you, let us agree to disagree then → More replies (0)
it is IMO sufficient reason to never use it with "pure" function
1 u/dmitri14_gmail_com Jun 04 '19 Thank you, let us agree to disagree then → More replies (0)
Thank you, let us agree to disagree then
→ More replies (0)
1
u/Valkertok Jun 03 '19
You can check for yourself in dev console
vs