17 lines
407 B
JavaScript
17 lines
407 B
JavaScript
'use strict';
|
|
|
|
function Person(name) {
|
|
if (!name) {
|
|
throw new Error("Name not set");
|
|
}
|
|
this.name = name;
|
|
//this.getName = () => `this.getName: ${this.name}`;
|
|
|
|
}
|
|
Person.prototype.getName = function (){ return `proto.getName ${this.name}`; }
|
|
|
|
var person = new Person("Kala");
|
|
console.log(Object.keys(person));
|
|
console.log(Object.keys(person.__proto__));
|
|
console.log(person.getName());
|