for-each code

PHOTO EMBED

Fri Jan 12 2024 02:18:05 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