I am encountering a situation where I have an array of arrays structured as shown below.
data = [
[
{x: 1, y: 40},
{x: 2, y: 43},
{x: 3, y: 12},
{x: 4, y: 60},
{x: 5, y: 63},
{x: 6, y: 23}
], [
{x: 1, y: 12},
{x: 2, y: 5},
{x: 3, y: 23},
{x: 4, y: 18},
{x: 5, y: 73},
{x: 6, y: 27}
], [
{x: 1, y: 60},
{x: 2, y: 49},
{x: 3, y: 16},
{x: 4, y: 20},
{x: 5, y: 92},
{x: 6, y: 20}
]
];
To determine the maximum value of y within this data set, I can utilize a nested d3.max() function call:
d3.max(data, function(d) {
return d3.max(d, function(d) {
return d.y;
});
});
My current challenge lies in deciphering the functionality of this code snippet. While I understand that the second argument in the d3.max() function specifies an accessor function, I am struggling to comprehend how the double invocation of d3.max() correlates with this accessor function.
In essence, what I am seeking is a step-by-step breakdown of how JavaScript processes this code. Even after attempting to dissect it using the console, I am still unable to grasp its full mechanics.