Discuss / JavaScript / 交作业啦

交作业啦

Topic source

xinyujaychou

#1 Created at ... [Delete] [Delete and Lock User]

var ch = document.getElementById('test-list'); for(let i = ch.children.length - 1; i >= 0; i--){ let text = ch.children[i].innerText; if(text !== 'JavaScript' && text !== 'HTML' && text !== 'CSS'){ ch.removeChild(ch.children[i]); alert(ch.children[i].innerText+" removed"); } }


  • 1

Reply