Skip to content

Instantly share code, notes, and snippets.

@MikeDigitize
Last active November 28, 2016 23:50
Show Gist options
  • Select an option

  • Save MikeDigitize/403902a5fd69b23dbb8f to your computer and use it in GitHub Desktop.

Select an option

Save MikeDigitize/403902a5fd69b23dbb8f to your computer and use it in GitHub Desktop.
Some coding challenges for the AO front end team who are learning JavaScript
function lotto() {
function getBalls() {
var random = getRandom(1,59);
if(!balls.includes(random)) {
balls.push(random);
}
if(balls.length < 6) {
return getBalls();
}
else {
return balls.sort((a,b) => a > b);
}
}
var balls = [];
return getBalls();
}
function getRandom(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment