Async functions inside Stimulus controllers

Hello,

I’m new to Stimulus and am finding it a really comfortable way of attaching js to my html :slightly_smiling_face:

However, I’m scratching my head a bit at the moment trying to figure out how to work with async function declarations inside a Stimulus controller, since methods inside Stimulus don’t (seem to) use the function declaration syntax.

For example, in a regular js file, I might have a function like this:

async function myFunction(a, b) {
...
}

How would I declare this inside a Stimulus controller? Using the same syntax?

Thank you very much.

I think the simple answer is to skip the word “function”, as discussed here: https://stackoverflow.com/a/47672826

Will try this out now.