Skip to content

Commit 2f4c2f4

Browse files
committed
Create Check Nums
1 parent eb69446 commit 2f4c2f4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Check Nums

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy