Last active
August 17, 2017 13:25
-
-
Save electerious/b2c5817cb162ebd2ae8662938ec69dc7 to your computer and use it in GitHub Desktop.
Repeat a function for a specified amount of times
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const repeat = (fn, times) => { | |
fn() | |
--times && repeat(fn, times) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: