Async functions inside Stimulus controllers


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:

Will try this out now.