Selecting from Many Options with Switch Statements // test not passing!

Tell us what’s happening:

only the alpha passing while the other 3 fail.

Your code so far


function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch(val)
  {
    case 1:
      answer= "alpha";
      break;
    case 2:
      asnwer= "beta";
      break;
    case 3:
      asnwer= "gamma";
      break;
    case 4:
      asnwer= "delta";
      break;    
  }
  
  
  
  // Only change code above this line  
  return answer;  
}

// Change this value to test
caseInSwitch(1);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements/

There is answer misspelled.

asnwer= “beta”;

1 Like

Check for typos.

1 Like