Learn Recursion by Building a Decimal to Binary Converter: Step 1 2 issue

Step 12 - here is my code below:

if (
    !numberInput.value ||
    isNaN(parseInt(numberInput.value)) ||
    parseInt(numberInput.value) < 0
  ) {

it keeps saying: 1. You should wrap the value returned by parseInt() in the isNaN() function. And add a third condition which checks the value returned by parseInt() to be less than 0.

As you can see, I have followed instructions! Please assist. Thanks in advance!

Hi there!

Post a link to the challenge step.

Hey pls see the link: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-recursion-by-building-a-decimal-to-binary-converter/step-12

Thxs!

Your if statement conditions are correct, you might have issue in the other part of your code, reset the challenge step and try again. If didn’t worked, clean your browser cache or change the browser for the challenge step.

Thanks for your speedy response! I just tried and unfortunately I’m still getting the same feedback. I also just tried on my mobile too…!

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

I realised I had missed off the curly braces at the end!