4 ms·
If you were trying to create a generalized getDistance function then the former would be preferred, but for this specific use case the latter outperforms the fo
by rockostrich 9y ago
If you were trying to create a generalized getDistance function then the former would be preferred, but for this specific use case the latter outperforms the former by 2 orders of magnitude: https://jsperf.com/reduce-vs-standard/1 https://jsperf.com/reduce-vs-standard/1