What's Wrong?

In main.js, refactor the third if/else block to use the ternary operator.

This is what I put…

let isLocked = false;

isLocked ? console.log(‘You will need a key to open the door.’) : console.log(‘You will not need a key to open the door.’);

let isCorrect = true;

isCorrect ? console.log(‘Correct!’) : console.log(‘Incorrect!’);

let favoritePhrase = ‘Love That!’;

favoritePhrase ? console.log(‘I love that!’) : console.log(“I don’t love that!”);

log the result of the ternary expression instead of calling log from within your ternary expression
you’re using it as an if-statement right now

Can you explain that a little further… I am a new at coding?

While you are free to use functions in expressions:

console.log(2) + console.log(1)

console.log does not produce a useful result, so perhaps you should instead use it to display the result of an expression:

console.log(1 + 2)

so what should it be?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.