Predict the output: var x = 5 ^ "0"; document.write(parseInt(x));
Answer options
A
Compile Time Error
B
NaN
C
0
D
5
Correct answer: 5
Explanation
JavaScript coerces "0" to 0 for bitwise operations. 5 XOR 0 equals 5.
Correct answer: 5
JavaScript coerces "0" to 0 for bitwise operations. 5 XOR 0 equals 5.
PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.