Re: combined d3 and Javascript


#1

For this lesson there is great code but no way to run it or experiment.


#2

Here is the code from the “Combined D3 with Fundamentals” achievement:

var save = false;

for (var size of [3, 8, 15]) {
  svg.append('circle').attr('r',size).attr('cx',pickRandom(100)).attr('cy',pickRandom(100));
}

var circles = d3.selectAll('circle');

function maybeDelete() {
  if (save === true) {
    print('circles are safe!');
  } else {
    circles.remove();
  }
}

circles.on('click',maybeDelete);

–Frankie