MV [YEP_ItemCore] Getting Sum of Armor Value

So I've been using the <On Creation Eval> for my weapons for some time now with great success. Now, I want to use the same approach for armor as well. Basically, I add the following to each piece of armor in the game:
<On Creation Eval> item._armorVal = 10; </On Creation Eval>
This is all fine and good since I'm using independent items. Now the issue comes to when I want to utilize the "_armorVal" I just created. I use YEP_ArmorScaling as well and need to find the sum of all the "_armorVal" that the actor has equipped. If I were simply trying to reference, say the Body slot, then it would be as simple as:
target.isActor && target.equips()[3] ? target.equips()[3]._armorVal : target.level * 10;
But I need to find the sum of all the equipped items... (and I don't think nesting a bunch of if statements would be the way to go, surely there's a better way).
I was hoping for something like this? But I'm not sure if I did it right...
JavaScript:
if (target.isActor) {
    var totalArmor = 0;
    for (var i = 0; i < target.equips().length; i++) {
        if (target.equips()[i]) {
            totalArmor += target.equips()[i]._armorVal;
        }
    }
    return totalArmor;
} else {
    target.def;
}
Try if (target.isActor()) { instead: you want to check the result of evaluating isActor on target, rather than whether the function exists on target. 👋
Try if (target.isActor()) { instead: you want to check the result of evaluating isActor on target, rather than whether the function exists on target. 👋
Ah, thank you! That's where my typo was...forgot the parenthesis.

Original thread: https://forums.rpgmakerweb.com/threads/yep_itemcore-getting-sum-of-armor-value.149062/