+ 1
js
const removeToast = (toast) => { toast.classList.add("hide"); if(toast.timeoutId) clearTimeout(toast.timeoutId); toast.remove(),500); } I want to ask what is the function of (timeoutId) I'm so confused
1 Antwort
+ 2
Looking at the call to clearTimeout(), looks like `toast.timeoutId` represents a timeout ID that was created using setTimeout() https://developer.mozilla.org/en-US/docs/Web/API/setTimeout
But can't say for sure about anything without looking at the toast object or its class - if it wasn't a literal.