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

Tell us what’s happening:

Step 104

You used the inputVal property as the id attribute for your paragraph elements. Now you can target those the paragraph elements with those ids.

Use the .getElementById() method to select the element with the id attribute with the value of the inputVal property of the current object.

Your code so far

const showAnimation = () => {
  result.innerText = "Call Stack Animation";

  animationData.forEach((obj) => {
    setTimeout(() => {
      animationContainer.innerHTML += `
        <p id="${obj.inputVal}" style="margin-top: ${obj.marginTop}px;" class="animation-frame">
          decimalToBinary(${obj.inputVal})
        </p>
      `;
    }, obj.addElDelay);

    setTimeout(() => {
      let obj = document.getElementById("inputVal.value")
    }, obj.showMsgDelay);
  });
};

I’m confused by the wording in this step. The .getElementById() method as I understand it will return the value of what I put in the quotes to a variable I assign.

This is what I have for this Step:

const obj = document.getElementById("inputVal.value")

The method should find inputVal.value and assign it to obj. This seems redundant to me.

The console is giving me this:

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

Can anyone explain this Step in more detail?

Your browser information:

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

Challenge Information:

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

you don’t have an element with id="inputVal.value" so you should not have a string there, it looks like you want the value of inputVal.value, that means not using the quotes

1 Like

Literally just solved this problem now but the amount of time I spent on it trying to figure it out is disgustingly hilarious :smiling_face_with_tear: . Pass in obj.inputVal as the parameter/argument inside your getElementById(), BUT, don’t use any quotations/literals/etc.

Code:
Mod edit: code removed

1 Like

Thank you! Really appreciate it when you guys let me know I’m not the only one spending hours learning this on my own. I wonder some times how anyone could get thru it without having an online community to bounce ideas and questions off of. This forum saves me time and again and I feel lucky to be a part of it!!! :innocent: :innocent: :innocent:

this one was hard the exercise is full confusing, cause you have to figure out by yourself a lot of things…