一個值時,下面的代碼刪除某個元件的所有子,除了這些所述saved
可變內列出。的appendChild()失敗嘗試追加存儲在數組中
let rightCol = document.querySelector("#rightCol");
let saved = rightCol.querySelectorAll('._4-u2._3-96._4-u8');
let savedArr = [];
saved.forEach(()=>{
savedArr.push(saved);
});
rightCol.innerHTML = ''; // Delete all children before retrieving "saved" ones.
for (var i = 0; i < savedArr.length; i++) {
rightCol.appendChild(savedArr[i]);
};
代碼失敗,此錯誤:
TypeError: Argument 1 of Node.appendChild does not implement interface Node.
爲什麼代碼失敗?