const p1 = document.createElement("p")
p1.innerText = 'p1'
const h = document.getElementById('h')
h.appendChild(p1)
// 宏任务:渲染之后执行(DOM 结构已更新)
setTimeout(() => {
const length = p1.innerText.length
alert(`macro task ${length}`)
})还没渲染p1就alert了