Created
July 8, 2023 02:59
-
-
Save kironroy/84a17bfabea2209d702eefc52bafa543 to your computer and use it in GitHub Desktop.
set time out
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
// setTimeout | |
const ingredients = ['olives', 'anchovies']; | |
const pizzaTimer = setTimeout( | |
(ing1, ing2) => console.log(`Here is your pizza with ${ing1} and ${ing2} 🍕`), | |
3000, | |
...ingredients | |
); | |
console.log('Waiting...'); | |
// will not rnder | |
if (ingredients.includes('anchovies')) clearTimeout(pizzaTimer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment