Last active
October 6, 2021 18:15
-
-
Save pedroglcbarros/0033ea77855ad28fdf542526520bfc1a to your computer and use it in GitHub Desktop.
Function to generate random numbers for a bingo game
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 nums = []; | |
| function bingo() { | |
| let draw = Math.ceil(Math.random() * 75); | |
| nums.includes(draw) ? bingo() : nums.push(draw); | |
| return nums; | |
| } | |
| for(let i = 1; i <= 75; i++) { | |
| bingo(); | |
| } | |
| console.log(nums); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment