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

Tell us what’s happening:

Sorry, your code does not pass. Try again.

You should use the .getElementById() method to target the element where the id attribute matches the value of inputVal for the current object.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

document.getElementById(`${obj.inputVal}`)

// User Editable Region

Your browser information:

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

Challenge Information:

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

I think your code is okay but for some reason this step wants you to pass the value of the variable and not the string literal containing it.

1 Like

thankyou it’s working now .

2 Likes

Is it because the program assumes the inputVal value is a string when put into the function? I’m wondering why this is the case.

I think it is just that this step’s testcase was written with something else in mind. They didn’t think people would try to interpolate the variable when they can just refer to the variable.

Edit: but also even though the variable contains a number, that number is probably coerced into a string by the js engine)