parseInt Functions with a Radix

parseInt Functions with a Radix
0

Tell us what’s happening:

Your code so far


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

convertToInteger("10011");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; 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

your function always return NaN because you are always trying to parse the string "str" - there isn’t a variable you should use instead?

You may want to revisit the challenge Basic JavaScript: Passing Values to Functions with Arguments.