Skip to content

Instantly share code, notes, and snippets.

@JohnnyMcFadden
Last active March 14, 2021 18:23
Show Gist options
  • Save JohnnyMcFadden/88b933e1db528cf54d5f07dbeed0995c to your computer and use it in GitHub Desktop.
Save JohnnyMcFadden/88b933e1db528cf54d5f07dbeed0995c to your computer and use it in GitHub Desktop.
The Joe Codes Blog - Spooky Event Loop - Synchronous
const changeEmojiDisplay = (type = 'show') => {
console.log('2');
const elements = document.getElementsByClassName('spooky-emoji');
for (let element of elements) {
console.log('(3) change element className');
element.className = `spooky-emoji spooky-emoji--${type}`;
}
};
const changeTextDisplay = (type = 'show') => {
console.log('5');
const elements = document.getElementsByClassName('spooky-text');
for (let element of elements) {
console.log('(6) change element className');
element.className = `spooky-text spooky-text--${type}`;
}
};
const start = () => {
console.log('1');
changeEmojiDisplay();
console.log('4');
changeTextDisplay();
console.log('7');
};
const reset = () => {
changeEmojiDisplay('hide');
changeTextDisplay('hide');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment