# caseInSwitch function -\> no idea what's wrong

**URL:** <https://forum.freecodecamp.org/t/caseinswitch-function-no-idea-whats-wrong/19044>\
**Category:** General\
**Created:** [July 10, 2016, 5:56pm UTC](https://forum.freecodecamp.org/t/caseinswitch-function-no-idea-whats-wrong/19044 "2016-07-10T17:56:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chocolate-mitochondr](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chocolate-mitochondr](https://forum.freecodecamp.org/u/chocolate-mitochondr)\
**Post date:** [July 10, 2016, 5:56pm UTC](https://forum.freecodecamp.org/t/caseinswitch-function-no-idea-whats-wrong/19044/1 "2016-07-10T17:56:14Z")

</div>

Hi!  
I’m pretty stuck at the caseInSwitch function. Here’s my code:

* * *

function caseInSwitch(val) {  
var answer = “”;

// Only change code below this line

switch (answer) {  
case val === 1 :  
answer = ‘alpha’;  
break;  
case val === 2:  
answer = ‘beta’;  
break;  
case val === 3:  
answer = ‘gamma’;  
break;  
case val === 4:  
answer = ‘delta’;  
break;  
}

// Only change code above this line

return answer ;  
}

// Change this value to test

caseInSwitch(3);

* * *

I tried writing ‘case 1:’ instead of ‘case val === 1:’ , but it still didn’t work.  
Could really use some help 🙂

---

<div class="post-metadata">

**Author:** ![chocolate-mitochondr](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chocolate-mitochondr](https://forum.freecodecamp.org/u/chocolate-mitochondr)\
**Post date:** [July 11, 2016, 5:20pm UTC](https://forum.freecodecamp.org/t/caseinswitch-function-no-idea-whats-wrong/19044/3 "2016-07-11T17:20:27Z")

</div>

Thank you! That solved my problem 🙂

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 3:47am UTC](https://forum.freecodecamp.org/t/caseinswitch-function-no-idea-whats-wrong/19044/4 "2021-01-16T03:47:56Z")

</div>

Closed on January 16, 2021, 3:47am UTC


