JavaScript infinite scroll with intersection observer
I think that container and images are being repeated unecessarly.

When you call imgGenerator in appendImages, you already know that you want an array of images.
You can use Array.from:

the first argument will be an array-like object, that is, an object that is accessed by index and with a length propertie(which is identified as images on our javascript)
the second argument will be the mapFunction(which will
be imgGenerator), a function that will be called for every
item of the array

Doing this, on imgGenerator you avoid to make an instance of an array(imgs), a push into it and a for loop every time you want this array, although, you will not need to pass images as parameter again

the container is always imgsContainer, so, in the appendImages you already know where to append


function imgGenerator() {
  const img = document.createElement("img");
  img.src = `http://api.adorable.io/avatars/${randomInteger()}`;
  img.classList.add('infinite-scroll-img');
  return img;
}

function appendImages(images) {
  imgsContainer.append(
    ...Array.from({ length: images }, imgGenerator)
  );
}

function handleIntersect(entries) {
  entries.forEach(entry =&gt; {
    if (entry.isIntersecting) {
      appendImages(5);
    }
  });
}

appendImages(5);