Inheritance

JavaScript

// QUIZ: Let's try our hand at inheritance.
function Person(){}
Person.prototype.getName = function(){
  return this.name;
};

function Me(name) {
    this.name = name
}
// Implement a function that inherits from Person
// and sets a name in the constructor
Me.prototype = Object.create(Person.prototype)

var me = new Me('Stepan');
console.log(me.getName());