Am finding difficult to pass this test

Below is my code for Updating the Height of an Element Dynamically::

 <style>
>   .bar {
>     width: 25px;
>     height: 100px;
 >     margin: 2px;
>     display: inline-block;
>     background-color: blue;
>   }
> </style>
> <body>
>   <script>
>     const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];    
>     d3.select("body").selectAll("div")
>       .data(dataset)
>       .enter()
>       .append("div")
>       .attr("class", "bar")
>       // Add your code below this line      
>       .style("height",(d) => d + "px");     
>       // Add your code above this line
>   </script>
>  </body>

But i seems to be having this error::

The first div should have a height of 12 pixels.

The second div should have a height of 31 pixels.

The third div should have a height of 22 pixels.

The fourth div should have a height of 17 pixels.

The sixth div should have a height of 18 pixels.

The seventh div should have a height of 29 pixels.

The eighth div should have a height of 14 pixels.

The ninth div should have a height of 9 pixels

please what could be the problem

please provide a link to the challenge, and code that can be copied to debug (so without the > at the start of each line)

https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/update-the-height-of-an-element-dynamically

please make easier to debug your code, I am not going to copy and paste to debug, and then have to delete all those > symbols as the code doesn’t work for syntax errors

<style>
  .bar {
    width: 25px;
    height: 100px;
    margin: 2px;
    display: inline-block;
    background-color: blue;
  }
</style>
<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];    
    d3.select("body").selectAll("div")
      .data(dataset)
      .enter()
      .append("div")
      .attr("class", "bar")
      // Add your code below this line      
      .style("height", (d) => d+ "px");     
      // Add your code above this line
  </script>
</body>
1 Like

yes, it seems something weird is going on. your code seems correct, you are returning the correct value from the callback… it doesn’t pass for me either
so I went to search in the github repository, and there is an issue on it
can you add your report here? so they know it’s still an issue

doesn’t work with the browser console open, but works in dev

If you have a new problem, please open a new topic for it.