欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS函數(shù)進階之prototy用法實例分析

 更新時間:2020年01月15日 10:48:59   作者:qq_42412646  
這篇文章主要介紹了JS函數(shù)進階之prototy用法,結(jié)合實例形式分析了JavaScript函數(shù)中使用prototy擴展屬性相關(guān)操作技巧,需要的朋友可以參考下

本文實例講述了JS函數(shù)prototy用法。分享給大家供大家參考,具體如下:

<html>
    <head>
        <title>js-prototype</title>
        <meta charset="UTF-8"/>
        <script type="text/javascript">
            function animation(name,data){
                this.name=name;
                this.data=data;
                this.print=function(a){
                    console.log(a);
                    return "賽高";
                }
            }
            function person(name,age){
                this.name=name;
                this.age=age;
            }
            function clannad(time){
                this.time=time;
            }
            person.prototype.watch=function(name){console.log("I am watching" + name)};
            animation.prototype.include=new clannad("2007");
            clannad.prototype.visi=function(a){console.log("2007出現(xiàn),震驚全球")};
            var a1 = new animation("clannad","2007");
            a1.include.visi();
//            console.log(a1.name);
//            console.log(a1.print("clannad"));
            var person1 = new person();
            person1.watch("境界的彼方");
        </script>
    </head>
    <body>
    </body>
</html>

運行結(jié)果:

感興趣的朋友可以使用在線HTML/CSS/JavaScript代碼運行工具http://tools.jb51.net/code/HtmlJsRun測試上述代碼運行效果。

更多關(guān)于JavaScript相關(guān)內(nèi)容可查看本站專題:《JavaScript常用函數(shù)技巧匯總》、《javascript面向?qū)ο笕腴T教程》、《JavaScript查找算法技巧總結(jié)》、《JavaScript錯誤與調(diào)試技巧總結(jié)》、《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)》及《JavaScript數(shù)學(xué)運算用法總結(jié)

希望本文所述對大家JavaScript程序設(shè)計有所幫助。

相關(guān)文章

最新評論