JS---原型链结构

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
        </head>
        <body>
        </body>
        <script>
            //改变原型后的原型链结构
            function F1 () {
                
            }
            F1.prototype=[];
            f1=new F1();
            //f1->[]->Array.prototype->Object.prototype->null
            
            //默认的原型链结构
            function F2 () {
                
            }
            f2=new F2();
            //f2->F2.prototype->Object.prototype->null
            
            //{}的原型链结构
            //{}->Object.prototype->null
            
            //[]的原型链结构
            //[]->Array.prototype->Object.prototype->null
            
            //DOM的原型链结构,以div为例
            //HTMLDivElement->HTMLElement->Element->Node->EventTarget->Object->null
            
        </script>
    </html>

 

posted @ 2018-06-21 09:46  框框A  阅读(133)  评论(0编辑  收藏  举报