Skip to content

Commit 8b8773c

Browse files
committed
tried simplified the condition checks in get angle type
1 parent 76ad0cc commit 8b8773c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
// Then, write the next test! :) Go through this process until all the cases are implemented
99

1010
function getAngleType(angle) {
11-
if (
12-
angle === null ||
13-
(typeof angle !== "number" && typeof angle !== "string")
14-
) {
11+
if (typeof angle !== "number" && typeof angle !== "string") {
1512
return "Input should be a number or a number in string";
1613
}
17-
angle = Number(angle);
18-
if (isNaN(angle)) {
14+
if (angle === null || isNaN(Number(angle))) {
1915
return "Input should be a number or a number in string";
2016
}
17+
angle = Number(angle);
2118
if (angle < 0 || angle > 360) {
2219
return "Angle should be between 0 and 360";
2320
}

0 commit comments

Comments
 (0)