A

Admin • 833K Points
Coach

Q. Which method can be used to convert a string to an integer?

Code:
let value = '42';
let result = parseInt(value);
  • (A) Number.parse()
  • (B) parseString()
  • (C) parseInt()
  • (D) toInteger()
  • Correct Answer - Option(C)
  • Views: 33
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

parseInt() is the standard method to convert a string to an integer in JavaScript.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.