FAQ: Control Flow - Putting It All Together

Hello,
Thank you for the note about Modern JS inserting semicolons automatically. I also did with and without - both worked. as long as we have { and } to start and finish, right?

Pretty much, yes. Blocks need to be defined with braces, and statements that occupy their own line don’t need semi-colons. To be on the safe side, though, using them is not such a bad thing.

1 Like

I have read this entire thread and have tried all the suggestions and it still is not working. When i click on ‘Give me the solution’, nothing happens. Can someone post the solution?

I’m not sure what I did different, I had this:
if (mode === ‘public’) {
showDetails();
} else {
hideDetails();
}

Did you take out the extra text?

HI, I am new to coding…
Question…how does the computer know what to show in this example… Is there another coding behind, what the problem is here to solve?

Good day guys, I tried to run this code but its not working. pls can someone help me out?
if (mode === ‘showDetails’) {
// Call a function here to show the post details

} (else === ‘hideDetails’) {
// Call a function here to hide the post details

}

Hello, everyone, I was wondering if anyone could answer why do we have to use brackets after showDetails, why is that?

capitalization of the D worked. TY

it worked. thanks. with or without the ;

Hi People!

I was wondering why do we need to capitalize the D in showDetails or hideDetails ??
In the other lessons i think i read that the code ist mostly lowercase, but why in this instance must be capitalized??
Nice week yall!