Created
November 18, 2016 13:58
-
-
Save IanRamosC/df6edd5704ff5c12f0db1fab968cfaa0 to your computer and use it in GitHub Desktop.
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
let generateRandom = _ => { | |
return (~~(Math.random() * 60)) + 1 | |
} | |
let generateMegaSenaResult = _ => { | |
let result = []; | |
while (result.length < 6) { | |
let number = generateRandom(); | |
if(result.indexOf(number) < 0) { | |
result.push(number); | |
} | |
} | |
return result.sort((a, b) => { | |
return a - b; | |
}).join(', '); | |
} | |
console.log(generateMegaSenaResult()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment