Accepted answer

When you call a function in d3.js .text its signature is:

.text(function(datum, index){



return "I can count up to " + d + a ; 


return string + datum + index.  

Finally, with Javascript, when you start with a string first, everything is coerced into a string so the d + a concatenates 5 and 0 and then 10 and 1.

Related Query

More Query from same tag