1.基本写法
function Student(name,age,sex){
this.name=name;
this.age=age;
this.sex=sex;
}
//简单的写法
Student.prototype={
constructor:Student,
height:"188px",
width:"55kg",
study:function(){
console.log("学习好凯西");
},
eat:function(){
console.log("我要吃好吃的");
},
}
var stu=new Student("段飞",20,"女");
stu.eat();
stu.study();
console.log(Student);
console.log(stu);
function Student(name,age,sex){