Script needed: Adding multiple variables to make another variable

I know it can be done in an ugly way with events, and I expect it can be done in a pretty way with a script, but I cannot do Javascript to save my life. What would the script be for adding several Variables together to make another Variable? Just a basic v[1]+v[2]+v[3]+v[4]=v[5] type of thing.
@WaywardMartian Fancy-pants option :

Code:
$gameVariables.setValue(5, [1,2,3,4].reduce(function(a, v) { return a + $gameVariables.value(v); }, 0));

Normal option :

Code:
$gameVariables.setValue(5, $gameVariables.value(1) + $gameVariables.value(2) + $gameVariables.value(3) + $gameVariables.value(4));
This is a script call, not a request for a plugin.

Moved to: RPGMaker MV
@Ossra Thank you!

@Kes And thank you. I couldn't remember if script call requests went under plug-ins or general MV questions and picked the wrong forum.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/script-needed-adding-multiple-variables-to-make-another-variable.115753/