Last active
March 14, 2021 18:23
-
-
Save JohnnyMcFadden/88b933e1db528cf54d5f07dbeed0995c to your computer and use it in GitHub Desktop.
The Joe Codes Blog - Spooky Event Loop - Synchronous
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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