Q23
Consider the following code snippet : var string2Num=parseInt("123xyz"); The result for the above code snippet would be :
A.
123
B.
123xyz
AnswerC.
Exception
D.
NaN
Answer: Option B
Solution
Answer: Option B
Solution:
The parseInt() function returns the first integer contained in the string or 0 if the string does not begin with an integer.