Last active
April 10, 2020 18:08
-
-
Save wormeyman/80e1d1c8fc0c46b37427b8e8daa3d57d to your computer and use it in GitHub Desktop.
Basic JavaScript: Chaining If Else Statements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements | |
function testSize(num) { | |
// Only change code below this line | |
if (num >= 20) { | |
return "Huge"; | |
} | |
else if (num < 5) { | |
return "Tiny"; | |
} | |
else if (num < 10) { | |
return "Small"; | |
} | |
else if (num < 15) { | |
return "Medium"; | |
} | |
else if (num < 20) { | |
return "Large"; | |
} | |
// Only change code above this line | |
} | |
testSize(7); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment