//a for-of loop async-friendly
for (const element of theArray) {
// ...use `element`...
}
//forEach not async-friendly
theArray.forEach(element => {
// ...use `element`...
});
//old-fashioned for loop
for (let index = 0; index < theArray.length; ++index) {
const element = theArray[index];
// ...use `element`...
}
//for-in
for (const propertyName in theArray) {
if (/*...is an array element property (see below)...*/) {
const element = theArray[propertyName];
// ...use `element`...
}
}