Tell us what’s happening:
I’m not quite understanding why the 2 worked for the radix. I thought the radix could be any number between 2 and 36. I placed a 5 inside for the radix and my code was wrong. What am I not understanding?
Your code so far
function convertToInteger(str) {
return parseInt(str, 2);
}
convertToInteger("10011");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.
the radix indicate the number system, so binary needs a 2
in general the radix can be any number in the range, but for this specific application there is one specific number needed
try console.log(convertToInteger("10011")) to print the value returned from the function on the console and change the radix, you will see the number change.