The clearInterval() method is not working after execution of the function body. here's the code snippet:
const clearAll = () =>{
const del = setTimeout(() => Display.textContent = 'deleted',100);
clearTimeout(del)
}
clearBtn.addEventListener("click", clearAll)
It seems you delete the timeout before it happens at least once. Try calling clearTimeout
after it executes.
const clearAll = () => {
const del = setTimeout(() => {
Display.textContent = 'deleted';
clearTimeout(del);
}, 100);
};
clearBtn.addEventListener("click", clearAll);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.