The main takeaway is that, using.each()
you get access to 3 things you need:d
,this
andi
. With.forEach()
, on an array (like in the example from the beginning) you only get 2 things (d
andi
), and you'd have to do a bunch of work to also associate an HTML element with those 2 things. And that, among other things, is how d3 is useful.
http://stackoverflow.com/questions/13465796/d3-javascript-difference-between-foreach-and-each
No comments:
Post a Comment