Peace to all.
Here is the solution :
Thank you all for your responsiveness!
Peace to all.
Here is the solution :
Thank you all for your responsiveness!
Hello @rab_Allaha
Congratulations tasks 1,2 and 4 are correct!
Here are two simplifications and a hint for task 3:
if (machineActive) {
instead of if (machineActive === true) {
because the variable itself is already true of false.if...else if...else
statements in your code. Those should be completely replaced by the switch statement. It should look something like this: if(machineActive) {
switch (true) {
case (/* What goes in here? */):
response = 'That was a terrible score — total fail!';
break;
case (/* What goes in here? */):
response = 'You know some things, but it\'s a pretty bad score. Needs improvement.';
break;
...
}
} else {
response = 'The machine is turned off. Turn it on to process your score.';
}
pwdResult
assignment at the beginning of the line:pwdResult = pwd === 'cheese' ? 'The password is correct' : 'Incorrect password';
This works, because the assignment is the last thing that happens after the ternary operator is evaluated.I hope that helps!
Michael
Hello @mikoMK. I have tried to correct these errors, if it is not difficult, can you check the solutions again? Thanks for the help
Great work on the update, @rab_Allaha!
Now it’s perfect! It’s rather unusual for a switch statement to have a fixed value in switch (...)
and conditions in case (...)
, but as we saw in this exercise it’s completely valid and works.
Happy coding,
Michael