Skip to content

Issue with Replacing If Else Chains with Switch #7588

Closed
shaanaa22 opened this Issue · 2 comments

2 participants

@shaanaa22

Challenge Replacing If Else Chains with Switch has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function myTest(val) {
  var answer = "";
  // Only change code below this line
  switch(val){
     case "bob":
      answer="Marley";
      return;
    case 42:
      answer = "The Answer";
      break;
    case 1: 
      answer = "There is no #1";
      break;
    case 99: 
      answer = "Missed me by this much!";
      break;
    case 7:  
      answer = "Ate Nine";
      break;

    }
  // Only change code above this line  
  return answer;  
}

// Change this value to test
myTest(7);

myTest("bob") should be "Marley" -- isn't getting passed. Please someone check the code.

@raisedadead
Free Code Camp member

@shaanaa22

Your code is not correct. Double check what you are returning in the first switch case.
Secondly, Github Issues are NOT for code help. Please ask for assistance in the Help Chat[https://gitter.im/FreeCodeCamp/HelpJavaScript]

Closing as not site issue

@shaanaa22

Thanks @raisedadead I just saw where I made the mistake. Sorry for the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.