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

Tell us what’s happening:

Hello. I am stuck on this step, can someone please tell me what is wrong with my code.

Step 16
Call the decimalToBinary function and pass in the value of numberInput as an argument. Also, make sure to use the parseInt() function to convert the input into a number.

Your code so far

const numberInput = document.getElementById(“number-input”);
const convertBtn = document.getElementById(“convert-btn”);
const result = document.getElementById(“result”);

const decimalToBinary = (input) => {


const checkUserInput = () => {
if (!numberInput.value || isNaN(parseInt(numberInput.value))) {
alert(“Please provide a decimal number”);

const decimalToBinary = (parseInt(numberInput.value));


convertBtn.addEventListener(“click”, checkUserInput);

numberInput.addEventListener(“keydown”, (e) => {
if (e.key === “Enter”) {

### Your browser information:

User Agent is: <code>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36</code>

### Challenge Information:
Learn Recursion by Building a Decimal to Binary Converter - Step 16

this is not how you call a function

first, you arleady have a variable decimalToBinary declared, you can’t declare it again, this will be a syntax error

how do you call a function?

Ah man!! I’ve forgotten the basics! To call a function, you use its name followed by parentheses.

function decimalToBinary()


Thank you for the help ilenia, much appreciated!!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.