Javascript: move elements in an array but based on another array data

Here’s what i’m trying to do. I have an Array arr with strickly 4 elements. can’t have more and can’t have less. I have another Array called shiftAmounts.
So here’s what I have and the result i’m looking for…

arr[A, B, C, D]
shiftAmounts[0, 1, 1, 3]
result: arr[A,"Empty", B, C]

So starting from the right (the fouth elements) it<s important, I have to move the D to the right by 3 space. Since I can’t have more than 4 elements, then it’s deleted
Next the C move one space to the right
Next the B move one space to the right
Next the A don’t move cause it has 0.
Elements never cross each others.
The change has to be in place.
tks for your help
Seby