D3 Challenge Won't Let Me Go Forward

I’ve tried using the provided solution, and a solution that uses a ternary and for some reason this challenge doesn’t pass for me: https://www.freecodecamp.org/learn/data-visualization/data-visualization-with-d3/change-styles-based-on-data

I even tried it in another browser to see if that would fix it. Any ideas what could be wrong here? Thanks

Please post your full code so we can better help you.

<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("color", (d) => {
        if (d < 20){
          return 'red'
        }
        else {
          return 'green'
        }
      })
      // Add your code above this line
  </script>
</body>

Are you using any browser extensions that change your CSS like a dark mode?

Oh good call! That was it haha

1 Like

Thanks! Sorry about that

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