I don't have the pre-generated code?

Hello, It’s about the assignment about ternary operators. but it actually involves many assignments.
No 1st, 2nd or 3rd if…else block appears on my screen, so I can not make the assignment because there is nothing to change by using ternary operators. I have this problem with almost all predefined commands that I have to edit. When I ask for a solution, I do not get a solution, but all assignments are approved while I have not yet executed them. Gladly because I can not continue working like this! Or do I have to pick up the assignments somewhere?
With best regards

Jeffrey Goei

Is there a reason why I can’t see the sample code for the exercises? Is it because I’m using the FREE version? Example, the ternary operator’s 3 exercises refer to sample code to reference to create the ternary line of code. I can’t see these …. am I missing something or do I have to 'Go Pro? I kinda noticed this in earlier exercises but I schlepped through it.
Thanks!

1 Like

I cannot see the sample code for this either. It still has my code for the previous exercise and when I delete that and refresh the exercise it keeps restoring the code for the previous exercise. Looks like it is supposed to include some code that mentions favoritePhrase? I can’t see this. Could anyone help out please?

Thanks

The sample code is in the lesson narrative.

let isNightTime = true;

if (isNightTime) {
  console.log('Turn on the lights!');
} else {
  console.log('Turn off the lights!');
}

We can use a ternary operator to perform the same functionality:

isNightTime ? console.log('Turn on the lights!') : console.log('Turn off the lights!');

The code from the previous lesson is meant to be carried over. Each step asks us to refactor one of the code segments.

Hi,

Thanks for your reply. So I should be Refactoring or editing this code just to be clear?

let tool = ‘marker’;

// Use short circuit evaluation to assign writingUtensil variable below:
let writingUtensil = tool || “pen”

console.log(The ${writingUtensil} is mightier than the sword.);

There’s definitely an error in this section as when I clicked solution the main.js doesn’t show anything. I’ve moved on to the next section which says “In main.js there is already an if...else statement in place” However my main.js shows nothing, there’s no if else statement there?

Yes, edit the code directly to refactor it into a ternary statement.

If anyone else runs into this problem, please report it to help.codecademy.com
For simplicity here is the code that should be in the window when you start the lesson.

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;

if (isCorrect) {
  console.log('Correct!');
} else {
  console.log('Incorrect!');
}

let favoritePhrase = 'Love That!';

if (favoritePhrase === 'Love That!') {
  console.log('I love that!');
} else {
  console.log("I don't love that!");
}