In JavaScript, how can I use the method queryForCollisionWith?

Hi guys!
I am trying to using, in JavaScript inside GDevelop5, the method queryForCollisionWith.
I have some experience with JavaScript.

In the help, it is described as:

I have a sprite and I would like to have all the objects collided with one.

Can someone provide me a small example of that?
Thank you!

That method is on the HSHG, the internally used data structure for platformer collisions.
I really disrecomend trying to get all colliding objects, as this means doing a collisions check against every object, which will take much performance.
To actually get a list of all colliding objects, first build a list of all instances:

let allObjects = runtimeScene.getAdhocListOfAllInstances();

Then I recommend prefiltering the array by position to remove too far away objects (it’ll probably be more performant than collisions checks)
Finally, filter using a collisions check:

let colliding = allObjects.filter(object => gdjs.RuntimeObject.collisionTest(object, yourObjectToTestAgainst));

Thanks for your answer, arthuro!

I am not developing a game. I want to make a Ladder Simulator - Ladder is a programming language used to program PLCs in industry.

What I intend to do is something like this:

So, I will not have many objects in the screen, since the programs will not be very big.

I am trying to use collisions as a way to detect the connection among the elements. So, I think using queryForCollisionWith will not impact a lot.

Anyway, another question is: is there any console I could print some informations inside GDevelop?

Thank you!

Sure, you can use the debugger; statement and console.log, and on the preview you can open the chrome dev tools with ctrl-shift-i.