How can I calculate average party level for events?

How would it be possible to calculate or create a variable that records the average level of all party members? Basically adding up the levels of party members 1-4 (their current class levels) then dividing it by 4.
Yes, but I am not good at explaining things! A game dev human shall arrive shortly to aid you. Variables are your friend!
@lianderson

Thanks! Your game looks pretty cool man, your comment just earned you a sale. =)
Code:
$gameParty.members().reduce((r, a) => r += a.level || 1, 0) / $gameParty.members().length;
should work for all party members.

Code:
$gameParty.battleMembers().reduce((r, a) => r += a.level || 1, 0) / $gameParty.battleMembers().length;
should work for only the active battle party members 🙂

have fun :*
Thank you mysterious stranger with no name. =P

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-calculate-average-party-level-for-events.132045/