You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe I found an issue with the description for testing case values. The module states that "case values are tested with a strict equality operator (===). I think this may be incorrect. My reasons are as follow:
1.) When using strict equality operators the Javascript console, the console flags these and provides and red error X. The code will not run using a strict equality operator.
2.) The W3C examples http://www.w3schools.com/js/js_switch.asp show an assignment operator being used, which my code below also uses and passes the test.
I'm still learning, but hopefully this helps and the corrections can be made. Thanks!
Browser Information
Google Chrome, Version 48.0.2564.109 (64-bit)
*OSX
Your Code
functionmyTest(val){varanswer="";// Only change code below this lineswitch(val){case1:
answer="alpha";break;case2:
answer="beta";break;case3:
answer="gamma";break;case4:
answer="delta";break;}// Only change code above this line returnanswer;}// Change this value to testmyTest(1);
Screenshot
The text was updated successfully, but these errors were encountered:
I looke at the code above but was not able to make the code work with strict equality but this is my code if people have questions or think it is wrong please leave me a comment.
`
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
break;
}
// Only change code above this line
return answer;
}
FreeCodeCamp Issue template
To Use this Template:
NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at https://gitter.im/FreeCodeCamp/Help
Issue Description
1.) When using strict equality operators the Javascript console, the console flags these and provides and red error X. The code will not run using a strict equality operator.
2.) The W3C examples http://www.w3schools.com/js/js_switch.asp show an assignment operator being used, which my code below also uses and passes the test.
I'm still learning, but hopefully this helps and the corrections can be made. Thanks!
Browser Information
*OSX
Your Code
Screenshot
The text was updated successfully, but these errors were encountered: