I need some help with this one

I am doing the Basic JavaScript: Replacing If Else Chains with Switch lesson and I cant get past this one.

function chainToSwitch(val) {

  var answer = "";

  // Only change code below this line

  switch(val) {

    case "bob":

      answer = "Marley";


    case 42:

      answer = "The Answer";


    case 1:

      answer = "There is no #1";


    case 99: 

      answer = "Missed me by this much!";


    case 7:

      answer = "Ate Nine";





  // Only change code above this line


this is what I have so far, the case statements are not equaling the values.

I move the thread to the appropriate subforum and I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


  1. When asking for help please included the link to the challenge.

  2. If you need help with the challenges you can click “Get Help” and then “Ask for help”. This will make a forum thread with your code and some information.

You are setting the answer variable, but you are not returning it.

1 Like