I am working my way through d3 tutorials, and learning both d3 and javascript as I go. My goal is to understand and alter the stacked bar chart example at this URL:
In the code for this chart, there is this passage:
data.forEach(function(d) {
var y0 = 0;
d.ages = color.domain().map(function(name) **{ return {name: name, y0: y0, y1: y0 += +d[name]}; });**
d.total = d.ages[d.ages.length - 1].y1;
});
Could you please tell me what kind of process or function is being done in the bolded line "{ return {name: name, y0: y0, y1: y0 += +d[name]}" ?? I get that it's defining the treatment of (name), but the code is so terse that I can't figure out a search term to discover what it's doing. I'm hoping for a response like "that's an example of someone doing x in js or d3, and you need to go here to read more about it."