Assessment wanted for my Conditionals 1,2,3 and 4 skill test

Hello. Could you please have my test assessed for Making decisions in your code - Conditionals

Here’s the Test your Skills page on MDN and below are my code:

Thank you in Advance

2 Likes

I was confused making the 3rd and 4th task on my own, seeing your code helped me solve it! Thanks dude.

2 Likes

Hi @tuhamworld

Great work! All your tasks work correctly. I just have some comments how you could make your code simpler:

  • In general you should try to consistently indent your code. This will greatly improve the readability. To see how good indention looks like you can format your code on CodePen:
  • Task 2: I would suggest using a separate condition for machineActive like you did in task 3. You could also remove the first half of the score condition, since for example score <= 39 also matches score == 20.
  • Task 3: Your switch condition can just be switch (true).
  • Task 4: The password check should be inside the if branch. (Only check the password, if the machine is turned on.)
  • Task 4: You could put pwdResult = in front of the condition:
    pwdResult = pwd === "cheese"
      ? "You have logged in successfully!"
      : "Your login attempt was not successful!";
    

I hope that helps :slightly_smiling_face:

@santisica29: Your email address is visible in your post. It ended up in the optional “name” field of your profile. I recommend removing it.

I wish you both a nice day,
Michael

2 Likes

You are welcome.
Am glad it was of help to you.

1 Like

Thank you so much for the additional feedback.
I have make the changes
Can you please check if it looks better now?

2 Likes

Yup, much better now. :clap:

1 Like