Assessment and help request for Conditionals Skill 1 Test

Hi. Any assessment would be appreciated.

conditionalsOne
conditionalsTwo
conditionalsThree
conditionalsFour

There are a few things I find worth to mention.

  1. In Conditionals 2 explanation,

Score of 20 to 39 — "You know some things, but it's a pretty bad score. Needs improvement."

it’d be nicer to change it's to it\'s, as is in

Score of 70 to 89 — "That\'s a great score, you really know your stuff."

to kill syntax error.

  1. I changed some of default code in conditionals 3 to make my program works.

In conditionals 3 code,

...
let machineActive = false; 
if (machineActive) {
// Add your code here
...

}

Since machineActive is false by default, I’m not sure how I can execute codes inside the block, so I changed the expression to !(machineActive).

Also, since case takes only one value, I had to put awfully long codes to include all integers from 0 to 100. I’m not sure if that’s what this question has asked, so please have an extra assessment on this matter and correct me if I’m wrong.

Those are my comments. As always, thank you for your time and have a great day! :cactus:

Hi there @harryghgim!

Some great answers here; well done!

answer 1 looks perfect.

for answers 2/3, you are allowed to change the machineActivevariable to true, to see if the machine works . I’ve added a note to make that clearer.

For assessment 3, yes, your switch statement has got somewhat out of hand :wink: It is possible to enter expressions for the cases, not just single values, to cut the required code down. See our answer to get an idea of how: learning-area/javascript/building-blocks/tasks/conditionals/marking.md at main · mdn/learning-area · GitHub

For assessment 4, you’ve got the logic absolutely right, but it’d be even better if you set a value for machineResult inside the if clause, so it gets a value when the machine is on or off. Something like:

if (machineActive) {
  machineResult = "Machine is turned on.";
  pwd === "cheese"
    ? (pwdResult = "Logged In!")
    : (pwdResult = "Sorry, invalid password.");
}

But overall, this is really good; well done!

1 Like