class People { constructor(name) { this.name = name; } getName() { return this.name; } } var person = new People("小王"); console.log(person.getName()); console.log(Object.keys(People.prototype)) function P(name) { this.name = name; } P.prototype.getName = function() { return this.name; } var p = new P("小张"); console.log(p.name); console.log(Object.keys(P.prototype)) console.log(typeof P); console.log(P("小伟"));