parseInt isnt working

Tell us what’s happening:

Your code so far

function convertToInteger(str, radix) {
 return parseInt(str,radix); 


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36.

Link to the challenge:

You’re missing your radix…

convertToInteger(“10011”, ???);

Is it like this?

function convertToInteger(str, radix) {

return parseInt(str,radix);

convertToInteger(“111001”, 57);

radix is the base of the number you wish to parse. A string of “1010101” is binary, aka base 2, so the radix would be 2.

A string like “JamesBond” would be valid base36, but I suspect you’re supposed to treat is as base10 and get a NaN result from parseInt.

Use parseInt() in the convertToInteger function so it converts a binary number to an integer and returns it.

You need to make it all binary. Also, don’t add new parameters to the function, the tests call the function with just one argument