Home » JavaScript » JavaScript Operators » Question
  1. The below code snippet is equivalent to __________.
    x = ~-y;
    w = x = y = z;
    q = a?b:c?d:e?f:g;
    1. x = a?b:(c?d:(e?f:g));
      q = ~(-y); w = (x = (y = z));
    2. x = (x = (y = z));w = ~(-y);
      q = a?b:(c?d:(e?f:g));
    3. x = ~(-y); w = (x = (y = z)); 
      q = (c?d:(e?f:g));
    4. x = ~(-y); w = (x = (y = z));
      q = a?b:(c?d:(e?f:g));
    5. None of these
Correct Option: D

Brackets have higher precedence than any other operator. The placement of brackets results in the same result as without putting any bracket.



Your comments will be displayed only after manual approval.