From 2612030f6186805fb64f5a06e9b478249181d2a3 Mon Sep 17 00:00:00 2001 From: ttran67 <ttran67@huskers.unl.edu> Date: Mon, 26 Aug 2024 22:34:10 -0500 Subject: [PATCH] Fixed C --- .../src/cSwitchStatements/switchStatements.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/javascript-practice/src/cSwitchStatements/switchStatements.js b/javascript-practice/src/cSwitchStatements/switchStatements.js index 031c4a2..8d01118 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> -- GitLab