0
console.log(document.createElement("p").appendChild(document.createTextNode("some text")));
回報
<TextNode textContent="some text">
?
console.log(document.createElement("p").appendChild(document.createTextNode("some text")));
回報
<TextNode textContent="some text">
?
因爲你的鏈接功能appendChild
你createElement
和任何返回將是最後一個返回值。您的console.log
語句會記錄上次返回值。
.appendChild()返回附加的孩子