Skip to content

Commit 266de36

Browse files
committed
Add initial value to reduce function
Fixes totalArea
1 parent a171b11 commit 266de36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class Shape {
119119
}
120120

121121
totalArea() {
122-
return this.areas().reduce((a, b) => a + b);
122+
return this.areas().reduce((totalArea, area) => totalArea + area, 0);
123123
}
124124

125125
perimeter(index) {

0 commit comments

Comments
 (0)