Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions STEP2_1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const {PI} = Math
const {pow} = Math

function checkType(arr) {
for (let i = 0; i < arr.length; i++) {
Expand All @@ -18,7 +19,7 @@ function circleArea(r) {
checkArgumentCount(arguments, 1);
checkType(arguments);

return PI * Math.pow(r, 2)
return PI * pow(r, 2)
}

function squareArea(width, height) {
Expand All @@ -39,7 +40,7 @@ function cylinderArea(r, h) {
checkArgumentCount(arguments, 2);
checkType(arguments);

return (2 * PI * Math.pow(r, 2)) + 2 * PI * r * h
return (2 * circleArea(r)) + 2 * PI * r * h
}

console.log(circleArea(3));
Expand Down