0 votes
130 views
in Javascript by (98.9k points)
edited

How can you convert the string of any base to an integer in JavaScript?

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer

The parseInt() function is used to convert numbers between different bases. parseInt() takes the string to be converted as its first parameter. The second parameter is the base of the given string.

To convert 4F (or base 16) to integer, the code used will be –

parseInt ("4F", 16);

Related questions

0 votes
1 answer 92 views
0 votes
0 answers 99 views
asked Apr 3, 2022 in Javascript by Doubtly (98.9k points)
0 votes
1 answer 92 views
0 votes
1 answer 100 views
0 votes
1 answer 100 views
asked Oct 9, 2022 in Javascript by MrRam (2.0k points)

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

504 users

...