JavaScript Operators
JavaScript Operators - Important Points
26. | What is the result of 2 != "2" in JavaScript? |
---|
A. 1
B. 0
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The != operator is the inequality operator. It returns true if its operands are not equal, after converting them to a common data type if necessary.
27. | What is the result of 2 !== "2" in JavaScript? |
---|
A. 1
B. 0
C. null
D. undefined
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The !== operator is the strict inequality operator. It returns true if its operands are of different types, or if they are of the same type but have different values.
28. | What is the result of "hello" + "world" in JavaScript? |
---|
A. hello world
B. helloworld
C. hello + world
D. worldhello
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The + operator is the concatenation operator when used with strings. It concatenates its operands to form a new string.
29. | What is the result of "3" / 2 in JavaScript? |
---|
A. 1.5
B. 2
C. 3
D. NaN
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The / operator is the division operator when used with numbers. When one of the operands is a string, JavaScript attempts to convert it to a number before performing the operation.
30. | What is the result of 5 % 2 in JavaScript? |
---|
A. 1
B. 2
C. 3
D. 0
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The % operator is the remainder operator. It returns the remainder of dividing its left operand by its right operand.