function intervalFunction() {
console.log("Hello");
setTimeout(intervalFunction, 1000);
}
setTimeout(intervalFunction, 1000);
let timeout;
function inputChange() {
clearTimeout(timeout);
timeout = setTimeout(function() {
console.log("Input stopped");
}, 1000);
}
let timeout = setTimeout(function() {
console.log("Hello");
}, 1000);
// 取消執行
clearTimeout(timeout);
let element = document.getElementById("element");
let position = 0;
function moveElement() {
position += 1;
element.style.left = position + "px";
if (position < 100) {
setTimeout(moveElement, 10);
}
}
moveElement();