Can someone please help me find what am I doing wrong with this else if statement?
When using string1 === string 2 ? ‘you agree’ : ‘you disagree’
// it works

but when doing this else if statement comes back with an unexpected token. It might be in front of me but I can’t see it.

Hi @renezambrano56494099
‘if’ and ‘else if’ belong together. ‘Else’ or ‘else if’ cannot run independently of ‘if’. So don’t end the if statement with a semicolon. The syntax is:

// your code
} else if (condition) {
// your code
1 Like

Thank you @mirja_t :slight_smile:

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