JavaScript Operators


JavaScript Operators

  1. The below code snippet is equivalent to __________.
    x = ~-y;
    w = x = y = z;
    q = a?b:c?d:e?f:g;











  1. View Hint View Answer Discuss in Forum

    NA

    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.


  1. “An expression that can legally appear on the left side of an assignment expression.” is a well known explanation for variables, properties of objects, and elements of arrays. They are called











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    lvalue is a historical term that means “an expression that can legally appear on the left side of an assignment expression.” In JavaScript, variables, properties of objects, and elements of arrays are lvalues.



  1. Among the following, which one is a ternary operator?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    JavaScript supports one ternary operator, the conditional operator ?:, which combines three expressions into a single expression. If else case can be replaced by the conditional operator


  1. Which of the operator is used to test if a particular property exists or not?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The operator “in” tests whether a particular property exists or not. In operator is usually added in looping statements to traverse the array or the object.



  1. What kind of an expression is “new Point(2,3)”?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    An object creation expression creates a new object and invokes a function (called a constructor) to initialize the properties of that object. Object creation expressions are like invocation expressions except that they are prefixed with the keyword new.