JavaScript Operators
- The below code snippet is equivalent to __________.
x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;
-
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.
- “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
-
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.
- Among the following, which one is a ternary operator?
-
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
- Which of the operator is used to test if a particular property exists or not?
-
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.
- What kind of an expression is “new Point(2,3)”?
-
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.