Error using an array as clickable stimuli for a mouse component

Description of the problem:
I want to present a grid of rock images as clickable stimuli. To do this, I created a list of ImageStims (named rock_grid) using a code component and put “rock_grid” in the field for clickable stimuli of the mouse. I can run the experiment on Python just fine but it seems to be incompatible with PsychoJS.

I got the following error:
TypeError: obj.contains is not a function

And below is the code block that causes the error:

// check if the mouse was inside our 'clickable' objects
          gotValidClick = false;
          for (const obj of [rock_grid]) {
            if (obj.contains(learn_mouse)) {
              gotValidClick = true;

Please let me know how I can resolve this problem. I know the standard way is to list individual objects separated by comma, but in my case the list would be very long so it’d be impractical to do so.

The problem is solved by add … in front of the “rock_grid” in the field, so that JS can correctly parse the individual elements of the rock_grid array rather than trying it treat the array itself as an element in a larger array.

But a caveat is that it only works for PsychoJS. To run it locally on Python, I’ll have to manually change it back.