关于作者

Discuss / JavaScript / 能帮我解答一下我为什么不通过吗?

能帮我解答一下我为什么不通过吗?

问题来源

沏曦

#1 Created at ...

// TODO var parent = document.getElementById('test-list'); var i,index = parent.children.length; for (i = 0; i < index; i++) { var e = parent.children[i]; if (e.toString() == 'JavaScript') { return; }else if (e.toString() == 'HTML') { return; }else if (e.toString() == 'CSS') { return; } parent.remove(e) }

o二重存在o

#2 Created at ...

你可以alert一下看看children[i]的类型,其实不是String,你需要比较的是它的innerText.


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.