js中call()用法

    <script>
        var towninfo = function() {
            this.townName = "fudian"
            this.country = towninfo.country;
        }

        towninfo.country = "china"

        Object.assign(towninfo, {
            showTownInfo() {
                return this.townName;
            }
        })

        var person = function(name) {
            towninfo.call(this);
            this.name = name;
        }

        person.prototype.showName = function() {

        }

        var ren01 = new person("xuhaitao")
        console.log(ren01);
    </script>

js中call()用法


 

FR:xuhaitao(QQ技术交流群:386476712)

上一篇:linux下的shell脚本


下一篇:I-country