美文网首页
关于面向对象函数的 new

关于面向对象函数的 new

作者: 乍暖还寒2002 | 来源:发表于2017-10-11 22:59 被阅读0次

function function_name (name_,qq_) {

// var this = new Object();//系统悄悄创建的

this.name = name_;

this.qq = qq_;

this.show_name = function(){

alert('我的名字' + this.name);

}

this.show_qq = function(){

alert('我的qq' + this.qq);

}

// return this;//系统悄悄创建的

}

var one = new function_name('hx','2313124');//函数前加上 new

var two = new function_name('red','43242314');

one.show_name();

one.show_qq();

two.show_name();

two.show_qq();

相关文章

网友评论

      本文标题:关于面向对象函数的 new

      本文链接:https://www.haomeiwen.com/subject/rfigyxtx.html