OR in Javascript

Does anyone know how i can use an || in a conditional statement?

Doing this:

var a = somethingif (a == 1 || a == 2) { $gameVariables.setValue(n, "x"); } else (a == 3 || a == 4) { $gameVariables.setValue(n, "y"); }throws a syntax error, unexpected token {
The problem there is your else. You are making a new condition but you didn't write the word if again
The problem there is your else. You are making a new condition but you didn't write the word if again
that does it. thank you.
if (x || y) {}
if (x || y) {}
... did you even read the OP? This doesn't help them at all.

And just as clarification for others:

Code:
var a = somethingif (a == 1 || a == 2) {   $gameVariables.setValue(n, "x"); } else if (a == 3 || a == 4) {   $gameVariables.setValue(n, "y"); }
its basic programming Zal ...
its basic programming Zal ...
 
that was not the point, re-read my initial post. i asked why my code is throwing an error, of which i thought was due to OR. But as pointed out by Hudell, my else statement is infact missing an if due to a new condition following it.

Original thread: https://forums.rpgmakerweb.com/threads/or-in-javascript.49445/