Submitted by WRETCHEDSORCERESS in just_post
twovests wrote (edited )
Reply to comment by twovests in I finally got my personal website functional by WRETCHEDSORCERESS
Also I decided to implement this, if you don't want the Thrill of Discovery and would rather just have someone tell you how to do it. (Which is okay + 100% cool to do)
twovests wrote
<script>
document.addEventListener
(
// The webpage "document" listens for an event titled "DOMContentLoaded".
"DOMContentLoaded",
// When this happens, it runs this "anonymous function"
// It takes no parameters, `()`, and runs everything inside the { }
() => {
// An array of splash text,
splashes = [
"born 2 post",
"Now with 100% more post!",
"Where's The Dog Honey?",
"I love you thiiiiiiis much",
"﷽﷽﷽﷽",
];
// And now, inside the webpage "document", find our "splash", and set its text.
// What do we set it to? splashes[ some_random_index ]
document.getElementById("splash").textContent = splashes[
Math.floor(Math.random() * splashes.length)
];
// Most programming languages have something like "Math.randrange(0, splashes.length)"
// But JavaScript hates you
}
);
</script>
<p id="splash"></p>
behold
Viewing a single comment thread. View all comments