Discuss / JavaScript / //删除

//删除

Topic source
let web=['JavaScript','HTML','CSS'];function contain(det){    for (const i in web) {        if (web[i]===det) return true;    }    return false;}let getId= document.getElementById('test-list');let getLi= getId.children;for (let i = 0; i < getLi.length; i++) {    if (!contain(getLi[i].textContent)){        getId.removeChild(getLi[i])        getLi.length--;    }}

  • 1

Reply