Skip to content

Instantly share code, notes, and snippets.

Last active Sep 22, 2020
What would you like to do?
const dirs = ["UP", "DOWN", "LEFT", "RIGHT"];
const max = 20;
const interval = 2500;
let i = 0;
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