File tree Expand file tree Collapse file tree 1 file changed +37
-10
lines changed
Expand file tree Collapse file tree 1 file changed +37
-10
lines changed Original file line number Diff line number Diff line change 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+ // }
You can’t perform that action at this time.
0 commit comments