My question is very similar to this. The solution there was that there was a <div> messing things up. There are no <divs> in mine.
I have this CoffeeScript code:
data = [0, 1, 2, 3, 4]
d3.select("body")
.data(data)
.enter()
.each((d, i) =>
console.log(i, d)
)
With the desired console output being:
0 0
1 1
2 2
3 3
4 4
The actual console output is:
1 1
2 2
3 3
4 4
I can get the desired output with this code:
data = [0, 1, 2, 3, 4]
d3.select("body")
.data(data)
.each((d, i) =>
console.log(i, d)
).enter()
.each((d, i) =>
console.log(i, d)
)
But it just feels wrong to have two .each() calls.