js创建对象的一种常用方式,利用了构造函数和原型

function Person(name,age){  
  this.name=name;  
  this.age=age;  
};   
Person.prototype.info=function(){   
  return name: +this.name+, age: +this.age;  
}; 
var x =new  Person(李小龙,33);  
alert(x.info()); 

js实现对象继承

function Student(name,age,profession){
    Person.call(this,name,age);
    this.profession=profession;
}
Student.prototype=new Person();
Student.prototype.constructor=Student;
var long=new Student(青天决,25,学生);
alert(long.lev());