elementsMaxRate issue.

JavaScript:
Game_Action.prototype.elementsMaxRate = function(target, elements) {
    
    // attackElements() determines whether this condition runs or not, should the target have any.
    if (elements.length > 0) {
    
        // When a target is attacked, their elementRate is returned as an
        // array. The elementId is retrieved from somewhere...
        const rates = elements.map(elementId => target.elementRate(elementId));

        // Returns the highest element Rate from the rates array.
        return Math.max(...rates);
    } else {
        return 1;
    }
};

I can't figure out where elementId is being set. Obviously it's being set by the game, because logging that through the console will return an undefined error.
The Array#map method iterates over all elements, transforming them according to a given callback function. In this case: element ID becomes the target's element rate for that ID. The callback function here is written as an arrow function: elementId is the name given to that arrow function's first argument.

Here are a couple of links for more details:
Thank you for that, although I had already read up there on Array.prototype.map, your explanation was clearer and I was able to 'see' what is actually happening.

From the logging I did:
[3,3].map(elementId => target.elementRate(elementId)) = [ice, ice] = [2, 2] (the element multipliers)

Original thread: https://forums.rpgmakerweb.com/threads/elementsmaxrate-issue.139212/