Jquery problem. trying to use index method

I am stuck with Jquery here. Trying to use the index method in the last function of initApp(). That way I have an array of append background: url… (CSS) on a loop and using DRY. However, I am stuck on it and can only show one background element on the site. I am trying to explain well what I am trying to do here -
I’m trying to run the initApp() function for every article that exists (running the function 10 times for an example) If I want something like that I maybe should add a parameter so the function would what index I am in and target that one, right?
So, in the each.function(index) - I can add the index, and then in initApp(index) - add index. and then in the initApp function I can adjust so that bottle[index] gets selected and then added.

But I am really stuck to know what I am doing wrong for not having it showing all background in the carousel slides…?

$(’#products article’).each(function(index) {

const initApp = (index) => {
const $container = getElement(’.container’);
const $bottle1 = createBottle();
const $bottle2 = createBottle();
const $bottle3 = createBottle();

  [$bottle1, $bottle2, $bottle3].forEach(($bottle, i) => {
    $bottle.classList.add('bottle' + i);
  $container.append($bottle1, $bottle2, $bottle3);