Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following JavaScript code?
var string2Num=parseInt(“123xyz”);

What will be the output of the following JavaScript code?
var string2Num=parseInt(“123xyz”);
a) 123
b) 123xyz
c) Exception
d) NaN

Answer: a
Explanation: The parseInt() function parses a string and returns an integer. The function returns the first integer contained in the string or 0 if the string does not begin with an integer.

Join The Discussion