I'm currently studying the Box Plot example in Mike Bostock's D3 gallery and I have some questions. Here is the code snippet from an Observable notebook:
Within this code snippet, there is a block of code that doesn't seem to be a function definition but has a return value:
chart = {
const svg = d3.select(DOM.svg(width, height));
const g = svg.append("g")
.selectAll("g")
.data(bins)
.join("g");
// [...]
return svg.node();
}
I'm curious about the purpose or meaning of the return
statement when it is not within a function definition.