Change Styles Based on Data ternary operator syntax

Tell us what’s happening:

its working when i wrote it as a regular if/else. im sure there is something wrong with the syntax of my ternary operator. Please help. Thank you.

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"))

     /* **_help me fix the code below_**
      .style("color", (d) => {
      ((d < 20) ? "red":"green")
}); */
  //This passes the challenge for me    
  .style("color", (d) => {
        if((d) < 20)
        {
          return "red";
        }
else 
{
  return "green";
}
      } ) 
      // 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.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3/change-styles-based-on-data/

You’re not returning anything in the code where you used the ternary, that’s why it doesn’t work.