Last active
June 17, 2020 08:02
-
-
Save ctjlewis/13f5ca4d4a3f64ff6963f37311fbcd83 to your computer and use it in GitHub Desktop.
In response to Tom Scott's video at https://www.youtube.com/watch?v=QPZ0pIK_wsc.
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
// define | |
const fizzBuzz = (conf, limit) => { | |
var num = 0; | |
const check = () => { | |
for (divisor in conf) | |
if (num % divisor == 0) return conf[divisor]; | |
return num; | |
}; | |
while (num++ < limit) console.log(check()); | |
}; | |
// call | |
fizzBuzz({ | |
3: "fizz", | |
5: "buzz" | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment