DEV Community 👩‍💻👨‍💻

Discussion on: Top 20 JavaScript tips and tricks to increase your Speed and Efficiency

liquorburn profile image
liquorburn • Edited on

I've made a simple benchmark, it seems that reduce() is faster than Math.max()

Thread Thread
techygeeky profile image
Kapil Raghuwanshi🖥 Author

That's awesome @liquorburn . I have added the fastest one only.

Thread Thread
tomy profile image
Tomy Smith • Edited on

It's actually the spread operator that's taking the time there. Though admittedly, there aren't many cases you'd have a hardcoded list of values to find the max of, it's worth pointing out.