Skip to content

Instantly share code, notes, and snippets.

@wormeyman
Last active April 10, 2020 18:08
Show Gist options
  • Save wormeyman/80e1d1c8fc0c46b37427b8e8daa3d57d to your computer and use it in GitHub Desktop.
Save wormeyman/80e1d1c8fc0c46b37427b8e8daa3d57d to your computer and use it in GitHub Desktop.
Basic JavaScript: Chaining If Else Statements
//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