is there a way to make that every created Child class with the `new` keyword, be automatically added to an array in the parent Class?

so we can use that array to loop on it or filter it, on applying some logic.

(with functional programming is easy this thing, but class base programming seems that the array isn't working)

---

**what I want?**

creating a array like this (in class parent)

```js
[new Child(), new Child(), new Child()]

```

---

I have a pretty long code, but since I am asking on StackOverflow,

 I created a mini-example for you so you can understand:

```js
class Parent {
  constructor() {
    this.array = [];
  }

  displayArray() {
    console.log(this.array);
  }
}

class Child extends Parent {
  constructor() {
    super();
    // "this" is new Child()
    // BUG: it don't push nothing 
    Parent.array.push(this);

    // console.log(Parent.array)
  }
}

// here I create 3 copies (as a example)
new Child();
new Child();
new Child();

// here the Parent Array need to be like this:
// this.array = [new Child(), new Child(), new Child()];
new Child();

// so I can do some loops and stuff with that array...
```