Mar 24 in JavaScript
Q: What output will come if we run the following part of the JavaScript code?

a) var string2Num=parseInt("123abc");  

b) Exception

c) 123abc

d) 123

e) NaN

1 Answer

0 votes
Mar 24

Answer: C

Reason: The "parseIn()" is a pre-defined method of the JavaScript that parses a string, and as a result, it returns an integer. It also returns the first digit as 0 if the string does not contain an integer in the first place.

Related questions

+1 vote
Mar 22 in JavaScript
0 votes
Mar 24 in JavaScript