D3 error on exit() step - need basic JS help!

Can someone take a look at my code to see why I am getting the following error message: TypeError: scatterPlot.exit is not a function

I tried StackOverflow but it wasn’t very helpful.

The specific change I am trying to make is filtering on continent: https://github.com/SabahatPK/6.05/blob/master/js/mainPractice.js

Any help would be much appreciated!

Edit: I know that it is b/c someData array is empty right before it is used in the data join, but I don’t understand why it is empty?

Try console.log(scatterPlot) to see what scatterPlot actually is. If not, find out what function is returning the bad value.

1 Like

Thanks @chuckadams ! I made an edit to original post which I think I posted at the same time as your reply:

Ah - never mind. I had all kinds of issues - starting with how I defined the data in the callback function vs how I defined the data in the function doing the calling. Argh - array of arrays of objects get so confusing so quickly.

Key change: update(formattedData[counter]); in here:

function step() {
  if (counter < 214) {
  } else {
    counter = 0;