Joins, Drill 4

Write the function removeEvenCircles that will take a selection of elements, remove the elements whose value fields are even, and return a selection with those elements. As before, each circle is bound to an object with the shape {key: ..., value: ...}.

<body>
  <svg id="svg">
  </svg>
  <script>
    var elements = d3.selectAll("#svg")
        .data([{ key: "4", value: 6},
               { key: "3", value: 12},
               { key: "2", value: 5},
               { key: "1", value: 10}],
              function(d) { return d.key; })
        .enter().append("circle");
    removeEvenCircles(elements); // write this function
  </script>
</body>

Try it

Editor
HTML Output
Messages

  
DOM