实例成员:构造函数内部通过 this 添加的成员。实例成员只能通过实例对象去访问。
静态成员: 在构造函数上添加的成员。静态成员只能通过构造函数去访问。
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title></head><body><script>/*实例成员:构造函数内部通过 this 添加的成员。实例成员只能通过实例对象去访问。静态成员: 在构造函数上添加的成员。静态成员只能通过构造函数去访问。*/function Person(uname,age){this.uname = uname;this.age = age;}Person.prototype.eat = function(){console.log('吃饭');}// 静态成员Person.weight = '178cm';Person.speak = function(){console.log('说话');}var p1 = new Person('jon',18)</script></body></html>
