The use of parseInt Function with a Radix

Tell us what’s happening:

Your code so far

function convertToInteger(str) {
 var a = parseInt('111001', 2 );
 return a;


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:

parseInt('111001', 2 )

Because of this your function will always return the same output; you hardcoded the ‘111001’ value.

Meaning :man_shrugging::man_shrugging:

Meaning, you are supposed to use the str parameter as the argument to parseInt.

As you have written it now the function will always return the same value and be of little use. You don’t want to have to write a new function for each string that needs to be converted, you want to write one function that can take in whatever string needs to be converted to a number and return it.

Still not working for me :thinking:

What does your code look like?

We really can’t help without seeing your code.

Please that is the link to my work.

We can’t see your code like that, you have to paste it into your post. Use the </> button in the post toolbar and paste your code where it says “type or paste code here”.

Edit: new thread