Skip to content

Instantly share code, notes, and snippets.

@ArnaudValensi
Created September 1, 2017 13:27
Show Gist options
  • Save ArnaudValensi/55731036eaaa0557dd67708afe834996 to your computer and use it in GitHub Desktop.
Save ArnaudValensi/55731036eaaa0557dd67708afe834996 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Twitch</title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Lato" />
<style>
* {
margin: 0;
padding: 0;
}
*, *:before, *:after {
box-sizing: border-box;
}
html, body {
height: 100%;
font-family: lato;
}
.content {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: blue;
}
.text-to-change {
font-size: 35px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="content">
<div class="text-to-change"></div>
</div>
<script>
var stringArray = [
'thomas',
'arnaud',
'jean-francois-mouloud-henri-robert',
'pierre',
'gui'
]
function getRandomArrayElement(array) {
return array[Math.floor(Math.random() * array.length)];
}
setInterval(function () {
var elem = getRandomArrayElement(stringArray);
console.log(elem);
document.querySelector('.text-to-change').innerHTML = elem;
}, 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment