Consider the following code snippet :
var string2Num=parseInt("123xyz");
The result for the above code snippet would be :
var string2Num=parseInt("123xyz");
A. 123
B. 123xyz
C. Exception
D. NaN
Answer: Option B
Solution(By Examveda Team)
The parseInt() function returns the first integer contained in the string or 0 if the string does not begin with an integer.Join The Discussion
Comments ( 1 )
Related Questions on Array and Function
Consider the code snippet given below
What is the observation made?var count = [1,,3];
A. The omitted value takes “undefined”
B. This results in an error
C. This results in an exception
D. None of the mentioned
A. true false
B. false true
C. true true
D. false true
The pop() method of the array does which of the following task ?
A. decrements the total length by 1
B. increments the total length by 1
C. prints the first element but no effect on the length
D. None of the mentioned
Consider the following code snippet :
What is the observation made ?if (!a[i]) continue ;
A. Skips the undefined elements
B. Skips the non existent elements
C. Skips the null elements
D. All of the mentioned
what is the output of parseInt(123xy); ?