原型和原型链

原型和原型链 1、构造函数—首字母一定大写 function Foo(name,age){ this.name = name; this.age = age; this.sex = '女'; // return this;            //默认有返回行 } //创建对象 var f = new Foo('zhangsan',20); 执行过程: (1)开始执行,this变成空对象 (2)
相关文章
相关标签/搜索