3 ms·
The concise reduce is fairly small: ages.reduce((a, c) => (a + (c > 18)), 0) Though usually in production code you'll see this as something like ages
by banashark 3y ago
The concise reduce is fairly small:
ages.reduce((a, c) => (a + (c > 18)), 0)
Though usually in production code you'll see this as something like
ages.reduce((acc, cur) => {
return acc + c > 18 ? 1 : 0
}, 0)
Which creates some more noise but ups readability