Creating groups - is there a better way

HI,
I need to create a series of groups from 1 to value that could be any number.

The only way I have successfully created them so far is using the following code with maxGroup being the number of groups to create.

for (let i = 1; i < maxGroup; i++) {
  window[group + i] = new THREE.Group();
};

I don’t really want to use window in the code for obvious reasons, so does anyone have any idea on any alternatives to the code above?

Thank You!!

const groups = Array(maxGroups).fill(0).map(() => new THREE.Group());

:eyes: ? You are free to create the groups in absolutely any way - was there an issue with creating groups in some way?