Added "hello" text
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
<header><div>
|
<header><div>
|
||||||
</div></header>
|
</div></header>
|
||||||
<main>
|
<main>
|
||||||
|
<h1 id="helloText"><noscript>Hewwo!</noscript></h1>
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
<!-- Left side -->
|
<!-- Left side -->
|
||||||
|
|||||||
3
main.js
3
main.js
@ -1,8 +1,11 @@
|
|||||||
const Maths = Math; // Yes, I'm that patriotic.
|
const Maths = Math; // Yes, I'm that patriotic.
|
||||||
|
const hellos = ['Hewwo!', 'Hello!', 'Awoo!'];
|
||||||
|
|
||||||
function pickRandom(array) {
|
function pickRandom(array) {
|
||||||
return array[Maths.floor(Maths.random() * array.length)];
|
return array[Maths.floor(Maths.random() * array.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('load', (e) => {
|
window.addEventListener('load', (e) => {
|
||||||
|
const helloText = document.getElementById('helloText');
|
||||||
|
helloText.innerText = pickRandom(hellos);
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user