Which sequence of if ... else
statements is incorrect?
if ... else ...
if ... else if ...
if ... else if ... else if...
if ... else ... else if ...
Explanation & Hint:
The sequence allows you to evaluate multiple conditions in a cascading manner. The first condition is checked, and if it is true, the corresponding code block is executed. If the first condition is false, the next condition is checked, and so on. If none of the conditions are true, the code block within the else statement is executed. The incorrect sequence “if…else…else if” does not follow the correct syntax and can lead to unexpected behavior or syntax errors in JavaScript. |