Help wanted for Conditionals 4 Test

Hello @chrisdavidmills. Just wanted to know if my code for the Conditionals 4 test is correct. I have it linked here: https://codepen.io/thenewcoderfromldn/pen/PoZZYmG

The link to the assignment is: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Conditionals

Thanks so much in advance.

Hey there @djkamar411! You’ll be pleased to know that you have got this VERY nearly right. The only issue was that the ternary operator line was not quite there:

  1. The test inside the line needs to use the equality operator, not the assignment operator (this is a really common mistake, so don’t let it worry you).
  2. pwdResult is already declared, so you don’t need the let keyword on the front. In fact, this’ll give you an error, because you can’t redeclare let variables.

The updated line looks like this:

pwdResult = (pwd === 'cheese') ? 'You have successfully logged in.' : 'You have not logged in successfully.';

But great work on the whole; you were so close!

Thanks so much! Will keep the equality operator in mind.

You are most welcome.