Please assess my code for Conditionals 4

Hello.

I would like a quick code assessment. The link is:

https://codepen.io/imanhuter/pen/ExPmYdP

Many thanks!

Hi @jag!

Your solution here works fine, nice work!

Note, you could also write your ternary operator line inside the if clause, like this:

if (machineActive) {
    machineResult = 'The machine is on.';
    pwdResult = pwd === 'cheese' ? 'Login successful.' : 'Password incorrect; login failed.'
} else {
    machineResult = 'Turn on the machine.';
}

Thanks! Didn’t know that ternary operators can also be written directly into conditionals :+1: