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

  • (A) 123
  • (B) 123xyz
  • (C) Exception
  • (D) NaN
πŸ’¬ Discuss
βœ… Correct Answer: (B) 123xyz
Explanation: The parseInt() function returns the first integer contained in the string or 0 if the string does not begin with an integer.
Explanation by: Mr. Dubey
The parseInt() function returns the first integer contained in the string or 0 if the string does not begin with an integer.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
184
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
85%
Success Rate