Data Visualization with D3 - Work with Data in D3

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];

    // Add your code below this line
d3.select("body").selectAll("h2")
.data("dataset")
.enter()
.append("h2")
.text("New Title");

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

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36

Challenge: Data Visualization with D3 - Work with Data in D3

Link to the challenge:
https://www.freecodecamp.org/learn/data-visualization/data-visualization-with-d3/work-with-data-in-d3.

It selects only 7 elements from h2, the platform tells me that there are 9 elements in total. I don’t know if it’s because I course through my cell phone since I don’t have a PC. Help pls.

What is data supposed to be working on here? The string “dataset” or the array dataset?

1 Like

Thanks You! I’m learning.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.