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

more_vert

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

more_vert

verified

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);