let array = [1, 2, 3, 4, 5];


array.forEach((num, index, arr) => {
  arr[index] = num * 2;

  console.log(array);
});