Chaining If Else Statements

EMBED

Wed Sep 21 2022 17:27:01 GMT+0000 (Coordinated Universal Time)

Saved by @chymax030 #javascript


function testSize(num) { // Only change code below this line if (num < 5) { return "Tiny"; } else if (num < 10) { return "Small"; } else if (num < 15) { return "Medium"; } else if (num < 20) { return "Large"; } else { return "Huge"; } return "Change Me"; // Only change code above this line } testSize(7);

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements