Call a Function Inside an Array with async/wait in JavaScript
September 2025
I'm working on alice.alanwsmith.com. It's a experiment where each letter of the alphabet gets its own styling that changes over time.
Dealing with the timing took a bit to figure out. I've got an array that holds collection of function that do the updates. Each one needs delays in various places.
This is the class based version of the solution I'm using:
Class Based
Output
Waiting for Class
HTML
Waiting for Class
JavaScript
const w = ;
w.
Function Based
And here's a function based approach when working outside of a class:
Output
Waiting for Functions
HTML
Waiting for Functions
JavaScript
const collection = ;
;
end of line
Endnotes
Replacing the ; look with a ARRAY.forEach((item) => {});javascript won't work. The functions will all fire but the await won't trigger so they go by without a delay.