10. JSX conditions : Is the space needed after the "if" syntax in React or is it just Codecademy wants us to put a space after it?

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

```

Replace this line with your code.

<do not remove the three backticks above>

You don’t have to, but the the indent makes the code much more readable, it would be foolish to not properly indent your code

if i was given a project with 10,000 lines of code with no indent at all, i would walk away at that very moment

Indent makes the code more readable, and easier to understand

2 Likes

Yeah, I understand that it is for styling and readability purpose. But when I was trying to do this exercise, missing the space after “if” resulted in an error message, so I was just wondering if we need it for syntax. Thanks!

My code: if(coinToss() === “heads”){
Correct Solution: if (coinToss() === “heads”) {

That doesn’t matter, that just seems to be a very strict exercise validition

4 Likes

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