i399exlang/ex4.js

17 lines
407 B
JavaScript
Raw Permalink Normal View History

2017-03-30 13:59:37 +03:00
'use strict';
2017-04-06 13:28:05 +03:00
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());