Q(Use parseInt() in the convertToInteger function so it converts a binary number to an integer and returns it.)

anyone tell me what the correct answer plz.
thanks .

function convertToInteger(str) {

}

convertToInteger(“10011”);

Parseint takes a string (so “10011”) and a number, which is the base (the radix). Decimal is base 10, so the number for decimal would be 10. Ocatal is base 8, so the number to parse an octal would be 8. This is binary, so…

1 Like

Thank you now i understood