Data Visualization with D3 - Add Inline Styling to Elements

Tell us what’s happening:

I already looked at the hint and I’ve looked at it for hours and every time I run the code it still doesn’t pass the 1st test. I look at the bottom part that I believe shows the error part but it is always pointing at the dot in the .style part. I’m already losing my mind.

Your code so far

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

    d3.select('body')
      .selectAll('h2')
      .data(dataset)
      .enter()
      .append('h2')
      .text(d => d + ' USD');
    // Add your code below this line
      .style('font-family', 'verdana')


    // 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/137.0.0.0 Safari/537.36

Challenge Information:

Data Visualization with D3 - Add Inline Styling to Elements

Hi @imcolecodes and welcome to our community!

You were caught out by a sneaky syntax issue.
When you are chaining methods like this, you append each method like this:

At the end of the chain you can add a semicolon to denote the end of the chain, but a semicolon in the middle of a chain will break the syntax. You have appended the correct method but you need to remove something for the chain to be syntactically correct.

1 Like

THANK YOU SO MUCH!!! I’ve been losing my mind for days trying to figure out what was wrong. You’re amazing dude!

1 Like