Variables in Stimulus

Hi,

This is my code:

connect {
    this.markers = [];
    this.lines = [];
    this.boxes = [];
}

deleteItems(list) {
    this.hideItemsOnMap(list);
    list = [];
    console.log(list);
    console.log(this.markers);
}

updateMap(data) {
    if (data.routes) {
        this.deleteItems(this.markers);
    ...

In my updateMap function, I wish to call the deleteItems function but then to pass it a list of items to delete from. Eg, this.markers.

However, it appears that it’s not being passed through correctly. it doesn’t appear that list refers to this.markers. How can I get it to refer to that?

How can I get this to work?