Work with Data in D3 understanding data and enter

Work with Data in D3 understanding data and enter
0

#1

This code snippet is supposed to be printing New Title 9 times but it is printing it only 7 times. Please help me understand why is that happening

Your code so far


<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14,9];
    
    // Add your code below this line
const new_t = 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/68.0.3440.84 Safari/537.36.

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


#2

because in data you have string "dataset" which have length 7 instead of variable dataset


#3

@lubodrinka Thanks . I missed looking at that.