Object relations : inheritance

by Cristi Salcescu

JavaScript

let bookPrototype = {
	title : undefined,
  author : undefined,
  getFullTitle : function(){
  	return this.title + " by " + this.author;
  }
}

let book = Object.create(bookPrototype);
book.title = "JavaScript: The Good Parts";
book.author = "Douglas Crockford";
console.log(book.getFullTitle());