With an object array that looks like this:
[{
    "202201": {
        "WO": 900,
        "WS": 0,
        "SY": 0.915,
        "LY": 0.98,
        "CT": 75
    },
    "202202": {
        "WO": 300,
        "WS": 0,
        "SY": 0.915,
        "LY": 0.98,
        "CT": 73
    },
    "202203": {
        "WO": 350,
        "WS": 0,
        "SY": 0.915,
        "LY": 0.98,
        "CT": 68
    },
    "202204": {
        "WO": 400,
        "WS": 0,
        "SY": 0.915,
        "LY": 0.98,
        "CT": 77
    },
    "202205": {
        "WO": 300,
        "WS": 0,
        "SY": 0.915,
        "LY": 0.98,
        "CT": 67
    },
    "Product": "A",
    "Facility": "a-Facility"
},
{
    "202201": {
        "WO": 6665,
        "WS": 0,
        "SY": 0.903,
        "LY": 0.993,
        "CT": 73
    },
    "202202": {
        "WO": 5907,
        "WS": 0,
        "SY": 0.903,
        "LY": 0.993,
        "CT": 71
    },
    "202203": {
        "WO": 5893,
        "WS": 0,
        "SY": 0.903,
        "LY": 0.993,
        "CT": 74
    },
    "202204": {
        "WO": 5486,
        "WS": 0,
        "SY": 0.903,
        "LY": 0.993,
        "CT": 67
    },
    "202205": {
        "WO": 5448,
        "WS": 0,
        "SY": 0.903,
        "LY": 0.993,
        "CT": 69
    },
    "Product": "B",
    "Facility": "b-Facility"
}]
I am attempting to find the maximum "CT" (or cycle time) for all products on a production line across all facilities. In the example above, it would be 77.
The closest (and most modern) example I can find that comes close looks like this:Math.max(...array.map(o => o.y)) and comes from this question about the max in an array of objects, but doesn't quite get into an array of objects and all numeric properties of each object.
I assume there's a way to map, not only the array of objects, but the object properties which have a property of "CT" (and replace "undefined" with 0) in order to arrive at the max of 77. I will continue investigating as I wait for support.
It's a typescript application, but a javascript answer will work for me, too.
PROGRESS:
I am also hoping for something more sophisticated than a double for loop, so if you can beat these options, I'll be super happy with it:
numbers = [];
data.forEach(d => {
    numbers = numbers.concat(Object.keys(d).map(p => d[p].CT ? d[p].CT : 0));
})
maxCycle = Math.max(...numbers);
data.forEach(d => {
    for (const w in d) {
        maxCycle = maxCycle < d[w]['CT'] ? d[w]['CT'] : maxCycle;
    }
});
 
     
    