fix: generating random greeting at every page load
This commit is contained in:
parent
62179e4051
commit
42646457eb
|
|
@ -9,6 +9,17 @@ const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
|
||||||
{randomMessage}!
|
{randomMessage}!
|
||||||
<span role="presentation">{randomEmoji}</span>
|
<span role="presentation">{randomEmoji}</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
<script is:inline>
|
||||||
|
const messages = ['Hi', 'Hello', 'Hey', 'Welcome', 'Ciao', 'Xin chào'];
|
||||||
|
const emojis = ['🍻', '🧑💻', '👋', '😎'];
|
||||||
|
const randomMessage = messages[Math.floor(Math.random() * messages.length)];
|
||||||
|
const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
|
||||||
|
|
||||||
|
document.querySelector('.documentFirstHeading').innerHTML = `
|
||||||
|
${randomMessage}!
|
||||||
|
<span role="presentation">${randomEmoji}</span>
|
||||||
|
`;
|
||||||
|
</script>
|
||||||
<style>
|
<style>
|
||||||
h1.documentFirstHeading {
|
h1.documentFirstHeading {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue