I came across the function below. There are multiple things I do not understand about the way it was written.
public getLegendCallback = (self => {
function handle(chart) {
return chart.legend.legendItems;
}
return chart => handle(chart);
})(this);
Why does this seem to be a function inside a function? Couldn't you also write
return chart.legend.legendItems
to get the same outcome?What does the
(this)
at the end do?