यदि हम निम्नलिखित दो वेरिएबल जोड़ते हैं तो किस प्रकार का मान मुद्रित होता है?
What type of value gets printed if we add the following two variables ?
var a = "10";var b = 50;
A
Long
B
Text
C
Integer
D
Number
Explanation
In JavaScript, the + operator can act as both an arithmetic operator and a string concatenation operator, depending on the type of operands.
Here:
ais a string ("10").bis a number (50).
When a string is involved in an addition operation, JavaScript concatenates the string with the number, converting the number to a string.
So, the result of adding "10" + 50 will be the string "1050" (string concatenation).
Thus, the correct answer is:
(B) Text.
Correct Answer: B) Text