Skip to content

Commit 38c0a36

Browse files
committed
solve check_nums problem
1 parent 30394ac commit 38c0a36

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

Check Nums renamed to check_nums.js

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,41 @@
1919
* *
2020
***************************************************************************************/
2121

22-
function CheckNums(num1,num2) {
23-
24-
if (num1 === num2) {
25-
return "-1";
26-
} else if (num2 > num1) {
27-
return true;
28-
} else {
29-
return false;
30-
}
31-
22+
const check_nums = (num1, num2) => {
23+
if (!num1 || !num2 || num1===num2) return '-1'
24+
return num2>num1 ? 'true' : 'false'
3225
}
26+
27+
28+
console.log(check_nums(1, 3)) //true
29+
console.log(check_nums(5, 7)) //true
30+
console.log(check_nums(7,5)) //false
31+
console.log(check_nums(7)) //-1
32+
console.log(check_nums()) //-1
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
// function CheckNums(num1,num2) {
50+
51+
// if (num1 === num2) {
52+
// return "-1";
53+
// } else if (num2 > num1) {
54+
// return true;
55+
// } else {
56+
// return false;
57+
// }
58+
59+
// }

0 commit comments

Comments
 (0)