Created
December 10, 2018 02:32
-
-
Save javascripto/4197b3be911f79791028604819fc63fe to your computer and use it in GitHub Desktop.
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 images = ['image1.jpg', 'image2.jpg', 'image3.jpg']; | |
| ((arr, fn, ms) => { | |
| let count = -1; | |
| setInterval(() => fn(arr[++count % arr.length]), ms); | |
| })(images, console.log, 1000); | |
| ((arr, fn, ms) => | |
| setInterval(() => arr.push(arr.shift()) && fn(arr[0]), ms) | |
| )(images, console.log, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment