Update the Height of an Element Dynamically

This code passed just one test. I don’t know what went wrong

Your code so far

  .bar {
    width: 25px;
    height: 100px;
    display: inline-block;
    background-color: blue;
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
      .attr("class", "bar")
      // Add your code below this line
      .style("height", d => d+'px'  ); // Maybe something is wrong here 
      // Add your code above this line

Your browser information:

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

Link to the challenge:

I tried this and it worked:
.style(“height”, (d) => ${d}px );

Here, I’ve used string literals to add ‘px’ to the value of d.
Hope this helps :slight_smile:

1 Like

I tried it but this is not working

Try resetting the code and then try again.

Still not working.:disappointed:

mine neither. is this ${d} syntax supposed to be working in D3? I know this is a jQuery syntax though.

It seems to work with

.style("height", (d) => d + "px" );