第一章认识JavaScript
JavaScript特性:
1.面向对象编程的语言.
function Person(name,age){ this.name = name; this.age = age; } Person.prototype.getName = function(){ return this.name; }; Person.prototype.getAge = function(){ return this.age; }; var p1 = new Person(‘John‘,30); var p2 = new Person(‘Bob‘,40); console.log(p1.getName()); console.log(p2.getAge());