[Solved] replace Foreach -> For [closed]


I don’t understand why you want to get rid of forEach, but you have the answer and it’s simple as this:

for (let i = 0; i < images.length; i++) {
  const oImage = new Image();
  oImage.onload = () => {
    ctx.drawImage(oImage, i * 100, 0, 100, 100);
  };

  oImage.src = images[i].textContent;
}

1

solved replace Foreach -> For [closed]