Tell us what’s happening:
I honestly don’t know what’s going on with the code. The function returns the values requested by the challenge. It converts the “string” (binary system) into integral numbers (decimal system). Could someone tell me what happens?
Your code so far
function convertToInteger(str,radix) {
return parseInt(str,radix);
}
console.log(convertToInteger("10011",2));
console.log(convertToInteger("111001",2));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix/