Learn Recursion by Building a Decimal to Binary Converter - Step 12

Tell us what’s happening:

I just don’t know on what mistake I am making.

I got this error.
“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.”

Your code so far

// User Editable Region

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

// User Editable Region

@cybordgeneral you also need parseInt in your third condition because the current data types don’t match. One is string and the other one is number.

1 Like