Why so little code?

Tell us what’s happening:

I’m so confused as to why there isn’t anything being entered in the “d” portion of the code? I would like to understand this more thoroughly.

Your code so far


<style>
.bar {
  width: 25px;
  height: 100px;
  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);


    // Add your code above this line
</script>
</body>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Update the Height of an Element Dynamically

Link to the challenge:

Hello there,

I assume you are referring to this:

(d) => d

In this case, because of this line: .data(dataset), every element after is being looped through by the number of elements in dataset. Now, in the above code, d represents an element of the dataset, and it is being set as the value of the height for the corresponding div.

Hope this helps

Okay i was unaware what to call it i didnt know if it was calling the dataset or something else and just wanted to leave little room for confusion! Thanks for your help!!!