Skip to content

Commit f3cdf03

Browse files
author
Gonzalo Diaz
committed
[BUGFIX] sonarcloud javascript:S6959 fixed.
"Array.reduce()" calls should include an initial value
1 parent 7df1f62 commit f3cdf03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/projecteuler/problem0018.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export function problem0018(_triangle) {
2626
console.debug('_triangle', JSON.stringify(weightsTree, null, 4));
2727
console.debug('leafs count', leafs.length, 'leafs', leafs);
2828

29-
const max = leafs.reduce((a, b) => (a > b ? a : b));
29+
const __START_FROM__ = 0;
30+
const max = leafs.reduce((a, b) => (a > b ? a : b), __START_FROM__);
3031

3132
return max;
3233
}

0 commit comments

Comments
 (0)