File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ /***************************************************************************************
2+ * *
3+ * CODERBYTE BEGINNER CHALLENGE *
4+ * *
5+ * First Factorial *
6+ * Using the JavaScript language, have the function CheckNums(num1,num2) take both *
7+ * parameters being passed and return the string true if num2 is greater than num1, *
8+ * otherwise return the string false. If the parameter values are equal to each other *
9+ * then return the string -1 *
10+ * *
11+ * SOLUTION *
12+ * This solution has to use an If...else if...else statement since you will be *
13+ * comparing for three different comparisons.
14+ * *
15+ * Steps for solution *
16+ * 1) If num1 and num2 are equal then return string -1 *
17+ * 2) Else If num2 is greater than num1 then return true *
18+ * 3) Else return false *
19+ * *
20+ ***************************************************************************************/
21+
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+
32+ }
You can’t perform that action at this time.
0 commit comments