is it a ternary operator (?)
Think of it as an IF expression.
statement before '?' is a condition of your if statement. Immediately, what follows before ":" will be executed / assigned if the statement is true. After the ':' is what will be executed / assigned if the statement is false.
However, your code will just warn 0 because you are not assigning anything from your ternary operator.
basically your code can also say.
x = 0; alert(x); // this would alert 0
you need to review this:
x = 0; var y = x > 0 ? 1 : -1; alert(y);
source share