It says the switch statement takes === (strict equality). However, in the answer the strict equality is not used. Has something changed since this part of the course was uploaded?
Also, this here:
function caseInSwitch(val) {
let answer = "";
I am gonna call it param val , (is that the proper name? )
How do I know that param must be taken to the code below to make the entire function works? This is a bugging issue for me, how do I know when and why include params in the functions ??
What are you seeing that makes you think that strict equality is not used by a switch statement? Internally, a switch statement still uses strict equality, as far as I know.
The term you are looking for is ‘argument’. You create arguments for whatever data your function requires to do it’s job. In this case, the function needs the val for the switch statement.
// 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;
}
// Change this value to test
caseInSwitch(1);