Adding/Subtracting from elements within an array

Hi everyone! First post! Nice to meet you all! I'm new to JS/coding, so apologies if there are any mistakes.

I have set one of my game variables to an array. I have two questions:

1) How can I add/subtract from one element within an array?

For example, if I wanted to subtract five from index zero so that this:
JavaScript:
$gameVariables.value(22) = [10, 11, 12];

would become this:
JavaScript:
$gameVariables.value(22)= [5, 11, 12];

2) How can I add/subtract a number from ALL of the elements of in my array?

For example, if I wanted to subtract five from EACH element so that this:
JavaScript:
$gameVariables.value(22) = [10, 11, 12];

would become this:
JavaScript:
$gameVariables.value(22)= [5, 6, 7];

Thank you in advance!

EDIT:
Apologies, but after tinkering around more with it I think I have figured it out. It might not be the cleanest code,

For number one I solved it with something like this:

JavaScript:
var numberarr = [1, 2, 3, 4, 5, 6, 7, 8]

var numberarr2 = numberarr.map( function(value) {
    return value - 1;
} );

var numberarr = numberarr2

$gameVariables.setValue(22, numberarr);

For number 2:

Code:
var holder = $gameVariables.value(22)[1] + 100;

$gameVariables.value(22)[1] = holder;

If there is a better/cleaner way to do this, feel free to let me know, but this has been working for now.
The solutions you came up with look correct, apart from apparently mixing up your numbers. What you described as the solution for question 1 is in fact for question 2 and vice versa.
The solutions you came up with look correct, apart from apparently mixing up your numbers. What you described as the solution for question 1 is in fact for question 2 and vice versa.
Woops, you're right about that haha. Thanks for your help!
Those look like solid enough solutions to both problems. Your other option with question 2 would have been a forEach loop:

Code:
numberArr.forEach(number => number -= 5);
Those look like solid enough solutions to both problems. Your other option with question 2 would have been a forEach loop:

Code:
numberArr.forEach(number => number -= 5);
This is great, thanks!

Original thread: https://forums.rpgmakerweb.com/threads/adding-subtracting-from-elements-within-an-array.124790/