Data Visualization with D3 - Work with Data in D3

Tell us what’s happening:
I do not know why it is wrong but I saw h2 of ‘New Title’ only 8 lines display even though there 9 dataset in the array. So, please help checking for this issue!

Your code so far

<body>
  <h2></h2>
  <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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.42

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

Link to the challenge:

It’s the <h2></h2> you have at the top (just under the body tag). It shouldn’t be there. Delete that and it’ll work.

1 Like

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