If statement Lesson help!

im not really sure what’s wrong with my code here for this step. can somone explain to me what i did wrong here?

You passed in true instead of the variable sale which is equal to true. It’s almost the same, but the point is that the if statement executes the code if the condition turns out to be truthy.
You can read more on the MDN Docs.

Happy coding :slight_smile:

1 Like

As a sidenote, it is often a good idea to use the hint provided with the instructions or check the documentation! Of course you are always welcome to make a post if something is confusing, but the documentation can teach you a lot about things you may already know something about and also teach you new things that you can use in future projects.

1 Like

ahh thanks for your reply!! wow dident even realize i feel so dumb lol

so a quick question if (solve) the console will only show the string if its true? and when false it will never show up on the console?

Yes.
If the condition is true, the code within the. {} will be executed.

let i = 1 console.log("first if statement:") if(i == 1) { console.log("Hello world") } else { console.log("Goodbye world") } i = 2 console.log("second if statement:") if(i == 1) { console.log("Hello world") } else { console.log("Goodbye world") }
1 Like