parseInt Function with a Radix not working

Tell us what’s happening:

In my console, I get the correct result but it won’t let me progress

Your code so far


function convertToInteger(string, radix) {
var r = parseInt(string, radix);
return r;
}

convertToInteger("10011", 2);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36.

Link to the challenge:

I don’t know if it is the issue as I have no idea which lesson is it as you have not written the link to it, but may it be that you have added a new parameter to the function? If that is the case, you need to remember that tests in the lesson will have only one argument, only the string and will not be able to give an output as radix will be undefined

1 Like

Basic JavaScript: Use the parseInt Function with a Radix

thats the name of the link it wont let me include links for some reason. But let me try what you said lol I think i did add a parameter!!

I think you are right but I don’t understand what you mean. I tried to take out the radix parameter that I added but it didnt work

If you just remove the radix parameter then you need to change also the body of your function to not use it

it doesn’t work, they want you to add the radix parameter i think. when I run console log I get the answers they want… confusing :roll_eyes:

You can’t add a new parameters, the function in the tests have only one argument

And if you can’t use the radix variable in the parseInt() find an other way to tell it what’s the base you want