Party's Stat check script

How to check the stats of party members?
I mean, how to check ATK of ANY active party member in conditional branch?
And what will be the condition? To get the data you want, simply use this code:

Code:
$gameParty.members()[index].atk

// Note that you'll have to replace "index" by the index of the party member you want to access.
And what will be the condition? To get the data you want, simply use this code:

Code:
$gameParty.members()[index].atk

// Note that you'll have to replace "index" by the index of the party member you want to access.
For example, "if at least one of party members has ATK more or equals 60"
Code:
var check = false;

for (var = i ; i < $gameParty.members().length; i++) {
    var pm = $gameParty.members()[i];
    if (pm.atk >= 60) {
        check = true;
        break;
    }
}

$gameSwitches.setValue(1, check);

This will set the game switch #1 (you can easily change the game switch id by changing the number) to true (ON) if any of the party members has an ATK of over 60. If not, it will set the switch to false (OFF). You can copy/paste the code and insert in a script call in an event.
Code:
var check = false;

for (var = i ; i < $gameParty.members().length; i++) {
    var pm = $gameParty.members()[i];
    if (pm.atk >= 60) {
        check = true;
        break;
    }
}

$gameSwitches.setValue(1, check);

This will set the game switch #1 (you can easily change the game switch id by changing the number) to true (ON) if any of the party members has an ATK of over 60. If not, it will set the switch to false (OFF). You can copy/paste the code and insert in a script call in an event.
Okay.
Then what about simple scripts like this one?
Code:
$gameParty.members().some(function (m) { return m.actor().atk >= 20; })
Because alright, I was used this script. But I doing something wrong, it gives "unexpected token =" error.
And I can set variable for one character's ATK. But what if in game i have at least three characters in party? Or player chooses one from three actors at beginning (like Hexen: Beyond Heretic), which have different stats and indexes?
EDIT: My mistake, read too fast. Just do m.atk instead of m.actor().atk.
If you want to put it even more concisely:
Code:
$gameParty.members().some(actor => actor.atk >= 20)

With anonymous functions, it's generally better to name the arguments something clear like "actor" rather than "m" for better readability.
If you want to put it even more concisely:
Code:
$gameParty.members().some(actor => actor.atk >= 20)

With anonymous functions, it's generally better to name the arguments something clear like "actor" rather than "m" for better readability.
Thank you.
I'm asking that because i want to make parameter check in game, where player chooses one of three pregenerated characters (like in Diablo or Hexen).

Original thread: https://forums.rpgmakerweb.com/threads/partys-stat-check-script.109138/