Multiple choice javascript

How do you write a conditional statement for executing some statements only if "i" is NOT equal to 5?

  1. if (i <> 5)

  2. if (i != 5)

  3. if =! 5 then

  4. if <> 5

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In JavaScript, the 'not equal' operator is != (like C/C++/Java). Option B correctly shows if (i != 5). Option A uses <> which is not JavaScript syntax (used in some BASIC dialects and SQL). Option C has incorrect operator placement (=! is not valid), and Option D is missing the variable and proper syntax.