Dear freeCodeCamp community:
I am still a d3 beginner. I am still not familiar with the the constructs in d3. I just try to use them but now I really want to break them down. Can anyone explain the part with arrow function and the ternary operator?
let svg d3.select(“svg”); let my_data = [4,5,6];
update = svg.selectAll(‘rect’) .data(my_data, (d,i) => d ? d:i);
how does the binding here happen? and what is especially the result of this here (d,i) => d ? d:i? I tried to search all the time but I could not find any matching answer.
Thank you very much