Skip to content

Instantly share code, notes, and snippets.

View Nicknyr's full-sized avatar

Nick Kinlen Nicknyr

  • South Florida
View GitHub Profile
@Nicknyr
Nicknyr / Call function synchronously while iterating through array elements
Last active December 9, 2017 23:41
Javascript: Looping over an array and calling a function in a sychronous manner using setInterval
// loop over the array using the iteratee function at the specified interval
function intervalForEach(array, iteratee, delay) {
let current = 0
let interval = setInterval(() => {
if (current === array.length) {
clearInterval(interval)
} else {