Last active
November 3, 2016 00:53
-
-
Save fmendozaro/526d02f08a1a586ddfc8dc2858130a92 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Randoms</title> | |
</head> | |
<body> | |
<div style="text-align: center;"> | |
<h2>Next to demo:</h2> | |
<div><h1><span id="res"></span></h1></div> | |
</div> | |
<script type="text/javascript"> | |
var niagaraList = [ | |
'Brian', | |
'Abdel', | |
'Christine', | |
'David', | |
'Papo', | |
'Halie', | |
'Harry', | |
'Jeff', | |
'Kevin', | |
'Melanie', | |
'Ned', | |
'Pedro', | |
'Pierre', | |
'RubenO', | |
'RubenV', | |
'Ryan', | |
'Vanessa', | |
'Yassine' | |
]; | |
var studentsThatHaveAlreadyDemod = [ | |
'Harry', | |
'Pedro', | |
'Halie', | |
'Jeff', | |
'RubenV', | |
'Brian', | |
'Kevin', | |
'Melanie', | |
'Papo', | |
'Pierre', | |
'Yassine', | |
'Ryan' | |
]; | |
var randomIndex = -1; | |
var randomStudent = ''; | |
// remove the students that have already demod | |
studentsThatHaveAlreadyDemod.forEach(function(student){ | |
// find the index of the current student in the students array and remove it | |
var index = niagaraList.indexOf(student); | |
niagaraList.splice(index, 1); | |
}); | |
// pick a random student | |
randomIndex = Math.floor(Math.random() * niagaraList.length); | |
randomStudent = niagaraList[randomIndex]; | |
console.log(randomStudent); | |
document.getElementById('res').innerHTML = randomStudent; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment