diff --git a/javascript-practice/src/cSwitchStatements/switchStatements.js b/javascript-practice/src/cSwitchStatements/switchStatements.js index 031c4a29ddb446f8900c4b3a2d66894ffc46d27a..8d011188e64963a97ab9c11899dbab37181eca39 100644 --- a/javascript-practice/src/cSwitchStatements/switchStatements.js +++ b/javascript-practice/src/cSwitchStatements/switchStatements.js @@ -5,7 +5,17 @@ export function decodeCountingNumber(word) { // INSTRUCTIONS: Use a switch statement to set meaning to 0, 1, 2, 3, or 4 if // word is 'zero', 'one', two', 'three', or 'four', respectively. Leave // meaning undefined in the default case. - // + if (word === 'zero'){ + meaning = 0; + } else if (word === 'one'){ + meaning = 1; + } else if (word === 'two'){ + meaning = 2; + } else if (word === 'three'){ + meaning = 3; + } else if (word === 'four'){ + meaning = 4; + } // Resources: // <https://javascript.info/switch> // <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch>