Replacing If Else Chains with Switch in js

Tell us what’s happening:

Your code so far

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

}```
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36```.

**Link to the challenge:**
https://www.freecodecamp.org/challenges/replacing-if-else-chains-with-switch
![image|690x387](upload://teEkVnpHmK4xDmelFIKgBuuWekS.png)

You didn’t put anything in the “Tell us what’s happening” section. Please tell us what is going on and what steps you have tried to fix it.


This is the problem i’m having please help me to solve chanllenge

Your function is not returning answer, so it returns undefined by default.

@Thejaswini-Nuthi
I would first advise you to align your code for readability, whether it be yours, or for anyone else who is looking at your code.
From what I see, it seems you forgot the most important thing about this function. It is supposed to return a value. That is one of your mistakes.

Thanks i have solved the issue