const runButton = document.getElementById("run-btn"); const logList = document.getElementById("log-list"); function appendLog(text) { const item = document.createElement("li"); item.textContent = text; logList.appendChild(item); } runButton.addEventListener("click", function () { logList.innerHTML = ""; appendLog("开始执行"); setTimeout(function () { appendLog("异步回调完成"); }, 600); appendLog("同步代码结束"); });