Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 383 Bytes

repeat-function-invocation.md

File metadata and controls

18 lines (16 loc) · 383 Bytes
title description author tags
Repeat Function Invocation
Invokes a function a specified number of times.
technoph1le
function,repeat
const times = (func, n) => {
  Array.from(Array(n)).forEach(() => {
    func();
  });
};

// Usage:
const randomFunction = () => console.log('Function called!');
times(randomFunction, 3); // Logs 'Function called!' three times