Control flow

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

}
https://www.codecademy.com/courses/learn-how-to-code/lessons/bop-control-flow/exercises/control-all-together

1 Like

@web3337448869

So you should have left it as if (mode === ‘public’) {
You want to move the call functions inside the if and else statements.
The (); on the end of showDetails and hideDetails is what makes the functions work.

if (mode === ‘public’) {
// Call a function here to show the post details
showDetails();
}
else {
// Call a function here to hide the post details
hideDetails();
}

^ That is what the code should be.

Thanks so much. it really help.

1 Like

@web3337448869

You’re welcome! :slightly_smiling_face:

// Build a list
myList = [‘codey sees the trail’, ‘codey starts the hike’, ’ codey is halfway’, ‘codwy reaches the finish’]
// select the 4th item from the list
// and save it to the variable selection

Hi, what I’m I missing from the code?

1 Like

@web3337448869

It’s asking you to take the fourth item from the list and save that to a variable named selection.

selection = myList[3]