原型简单语法
function Student(name,age,sex) {
this.name = name;
this.age = age;
this.sex = sex;
}
Student.prototype = {
//手动修改构造器的指向
constructor:Student,
height:"188",
weight:"55kg",
study:function () {
console.log("xuexi")
},
eat:function () {
console.log("chi")
}
};
var stu =new Student("!","12","2")
stu.eat();
stu.study();