for-each EXAMPLE

PHOTO EMBED

Fri Jan 12 2024 02:41:59 GMT+0000 (Coordinated Universal Time)

Saved by @Sephjoe

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


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

  console.log(array);
});

content_copyCOPY