We need a solution for improvement : Building a Decimal to Binary Converter - Step 103

Tell us what’s happening:

Throughout the process, we have consistently passed strings to the getElementById method. On the other hand, the inputVal property in the objects within animationData is an integer. Along the way, we’ve rejected implicit type conversion and have enforced strict equality (===), even going so far as to explicitly convert values to String in some parts of the code. But now, all of a sudden, it’s asking to pass the integer value from the object directly. This doesn’t align with the overall approach we’ve taken so far.

For a seasoned developer, this might not be a problem. However, for someone less experienced, this could become an “unsolvable” issue.

In the previous step, we used backticks (``) to create a string and set the id for the <p> element. Naturally, we would expect to use the same backticks to create a string for getElementById when locating the element.

This process either needs additional explanation or the answer-checking method should be adjusted to improve consistency.

Your code so far

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

/* file: styles.css */

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

// suddenly implicitly casting needed and is a "correct answer".
// but obj.inputVal is prepared as "INTEGER".
document.getElementById(obj.inputVal);

 // most case write like this because of previous step and only use this method with "STRING"
document.getElementById(`${obj.inputVal}`); 
// or maybe like this code
document.getElementById(String(obj.inputVal)); 

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0

Challenge Information:

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

I suggest you bring this up on GitHub to discuss it with fCC developers.