Last active
April 20, 2018 07:30
-
-
Save vldvel/e4b6fd0e8edab5d0b05275f2cf53f2bc to your computer and use it in GitHub Desktop.
lodash reduce vs native reduce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
const timerDateReduceLodash = new Date(); | |
console.log('lodash reduce', reduce(numbers, (sum, n) => sum + n, 0)); | |
console.log('lodash time', new Date() - timerDateReduceLodash); | |
const timerDateReduceJS = new Date(); | |
console.log('native reduce', numbers.reduce((sum, n) => sum + n, 0)); | |
console.log('native time', new Date() - timerDateReduceJS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment