JavaScript Operators
JavaScript Operators - Important Points
6. | Which operator is used for exponentiation in JavaScript? |
---|
A. ^
B. **
C. *
D. /
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The ** operator is used for exponentiation in JavaScript.
7. | What is the result of 2 ** 3 in JavaScript? |
---|
A. 6
B. 8
C. 9
D. 10
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The ** operator is used for exponentiation. 2 raised to the power of 3 is 8.
8. | What is the result of "5" + 2 in JavaScript? |
---|
A. 7
B. 7
C. 52
D. 52
View Answer Discuss Work SpaceAnswer: option d
Explanation:
When one of the operands of the + operator is a string, JavaScript treats the other operand as a string as well, and concatenates the two strings.
9. | What is the result of "5" - 2 in JavaScript? |
---|
A. 3
B. 3
C. 52
D. 52
View Answer Discuss Work SpaceAnswer: option b
Explanation:
When the - operator is used, JavaScript tries to convert both operands to numbers. In this case, "5" is converted to 5, and the result of the subtraction is 3.
10. | What is the result of 10 + "5" in JavaScript? |
---|
A. 105
B. 15
C. 15
D. 1005
View Answer Discuss Work SpaceAnswer: option a
Explanation:
When one of the operands of the + operator is a string, JavaScript treats the other operand as a string as well, and concatenates the two strings.