Use the parseInt Function with a Radix(SOS)

Tell us what’s happening: I am having troubles understanding what im doing incorrectly

Your code so far



function convertToInteger(str) {
 var a = parseInt("10011", 2); 
return a;
}

convertToInteger("str");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 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

You need to pass the str variable from the function into the parseInt and you shouldn’t have had to change the argument converToInteger() started with.

This code should work:

function convertToInteger(str) {
 return parseInt(str, 2); 
}
convertToInteger("10011");