2021-05-16

使用ES6實(shí)現(xiàn)該方法

const obj={a:1,b:2,c:3};
function foo(o,arr){
    //請實(shí)現(xiàn)該方法
}

foo(obj,["a","c"]);

Element又繼承自Node和EventTarget,可以查閱:DOM進(jìn)階之EventTargetDOM進(jìn)階之Node。

屬性

Element有非常多的屬性。
attributes,classList,className,clientHeight,clientLeft,clientTop,clientWidth,Element.id,Element.innerHTML,localName,namespaceURI,outerHTML,prefix,scrollHeight,scrollTop,scrollWidth,tabName

方法

Element有非常多的方法
addEventListener,attachShadow,dispatchEvent,getAttribute,getAttributeNames,getBoundingClientRect,getElementsByClassName,getElementByTagName,hasAttributes,insertAdjacentElement,querySelector,querySelectorAll,removeAttribute,removeEventListener,scroll,scrollBy,scrollIntoView,scrollTo,setAttribute,toggleAttribute

事件

可以使用addEventListener添加事件。
cancel,error,scroll,select,show,whell copy,cut,paste compositioned,compositionstart,compositionupdate blur,focus,focusin,focusout fullscreenchange,fullscreenerror keydown,keypress,keyup auxclick,click,contextmenu,dbclick,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,moseup touchcancel,touchend,touchmove,touchstart

跳出循環(huán)

outer_loop: 
for(i=0;i<5;i++) {
    for(j=i+1;j<5;j++) {
        break outer_loop;
    }
    alert(1);
}
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容