Every D3js beginner must be going through this thought, I am pretty much sure about it.
I have been around this thing for few hours now!!!!But I don't know how to use it and what is the difference between them?
function(d){return d}
function(d,i){return d and some more custom code}
for Example--->
var data = [4, 8, 15, 16, 23, 42];
Function(d):::::
chart.selectAll(div)
.data(data)
.enter().append(div)
.style(width, function(d) { return d * 10 + px; })
.text(function(d) { return d; });
------------------------------------------------------------------------------------
Function(d*i):::::
chart.selectAll(rect)
.data(data)
.enter().append(rect)
.attr(y, function(d, i) { return i * 20; })
.attr(width, x)
.attr(height, 20);