I am trying to move an array to the right by a set value, and replacing the now missing spaces with 0. I just can not figure out how to do it.
Array before moving:
let array = [1,2,3,4,5,6,7]
Array after moving 2 to the right:
array = [0,0,1,2,3,4,5]
Ive looked at other stack overflow posts but those just wrap around the data making a move to the right look like this:
array = [6,7,1,2,3,4,5]
Whilst I want to just remove the 6 and 7.