Vidyalelo
JavaScript · Q23

Array And Function

Programming · JavaScript · question 23

Q23

Consider the following code snippet : var string2Num=parseInt("123xyz"); The result for the above code snippet would be :

A.
123
B.
123xyz
Answer
C.
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.