Can't make d3 work - dynamic d3 question

Tell us what’s happening:
I can’t do even this simple task of " Work with Dynamic Data in D3". The lesson is very unclear. If I add “selection.text” it says that selection is undefined, unknown.


<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
    
    d3.select("body").selectAll("h2")
      .data(dataset)
      .enter()
      .append("h2")
      // Add your code below this line
      
      selection.text("(h2)=>USD") // i tried this
          // and this
      selection.text("(d)=>h2=>USD") 
      // Add your code above this line
  </script>
</body>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36.

There is no variable selection being created so that’s error is normal to get

Here there is a series of chained methods, which is creating and selecting the h2 elements, so you already have them selected. you need to chain the methods you are using to this.

Also, you need to pass a callback to text(), you are passing in a string