Consider the following code:
circle.each(function (d) { //...code });
How can I break the loop? Is there a natural D3 way to break out of an each loop? I mean without a flag as follows:
var flag = false; circle.each(function (d) { if (flag) return; if (someCondition) flag = true; //...code });
I've tried returning false inside the if statement but it did not work (thought that maybe this would work the same as jquery.each
but I was wrong):
circle.each(function (d) { if (someCondition) return false; //Not working //...code });