Home » JavaScript » JavaScript Operators » Question
  1. What will be the output of the following Javascript code?
    var str1 = ”4321”;
    var intval = 4321;
    alert( str1 + intval );
    1. 4321
    2. 43214321
    3. 8642
    4. 12341234
    5. None of these
Correct Option: B

In JavaScript the alert function does the type casting and converts the integer value to string. After that it concatenates both the strings and shows the result as a concatenated string. Thus 43214321 would be correct.



Your comments will be displayed only after manual approval.