Last active
September 22, 2020 11:09
-
-
Save coderbyheart/578110b662e271a692954c292c60bb3a to your computer and use it in GitHub Desktop.
heads.js
This file contains 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 dirs = ["UP", "DOWN", "LEFT", "RIGHT"]; | |
const max = 20; | |
const interval = 2500; | |
let i = 0; | |
console.time("heads"); | |
const r = setInterval(() => { | |
const n = Math.floor(Math.random() * dirs.length); | |
console.timeLog("heads", ++i, dirs[n]); | |
if (i >= max) clearInterval(r); | |
}, interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment