Create Variable and Equal to Boolean

This is the instruction for the first practice of control flow of if/else statements: Create a variable named isSoccerFan and set it equal to a boolean, based on your preference.

So i put this: let isSoccerFan = true;
It is correct right? Because it doesn’t take it as right, then my whole code is this:

let isSoccerFan = true;

if (isSoccerFan) {
} else {
  console.log('No goal!');

Although it runs, i get an X next to the instructions…

We do not have lessons on speed dial so depend upon the member to post a link with each new topic. Please post a link to the exercise.

Copy the URL from the location bar of the lesson page and paste it into a post.

1 Like

Code looks correct and should be accepted. Try a page refresh and see if that makes any difference. Sometimes switching browsers works.

Looks like you’re missing the following:

if(isSoccerFan === true)

Help from CONTROL FLOW - Comparison Operators II

It can be confusing when to use one = sign and when to use three === signs.

Use a single = to assign a value to a variable. Use === to compare the values of two different variables.

When a variable is a boolean, we don’t need to use a comparison.

if (isSoccerFan)

is the same thing.

Good to know! Thanks for clearing that up mtf!

1 Like

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