times

Runs a function a specified number of times. Optionally pass in a delay between each execution. Returns the returned value of the last execution.

async function times(fn: Func | AsyncFunc, times: number, delay?: number)

// Example:

let n = 1

const incrementN = () => n += 1

times(incrementN, 3) //=> 4