Selections, Drill 3

Write the function selectCircles to return a d3 selection of all the circles in the svg element.

<body>
  <div>
    <svg id="svg">
      <circle cx="100" cy="50" r="20" fill="red"></circle>
      <circle cx="130" cy="50" r="20" fill="green"></circle>
      <circle cx="160" cy="50" r="20" fill="blue"></circle>
    </svg>
  </div>
  <script>
    var sel = selectCircles(); // write this function
  </script>
</body>

Try it

Editor
SVG Output
Messages

  
DOM