001
002const aBook = {
003 title: null,
004 author: null,
005 yearOfRelease: null,
006 getYearOfRelease() {
007 return this.yearOfRelease;
008 },
009 introduceAuthor(message) {
010 return `${this.author} ${message}`;
011 },
012};
013
014console.log(aBook.getYearOfRelease());
015
016const theDaVinciCode = {
017 title: 'The Da Vinci Code',
018 author: 'Dan Brown',
019 yearOfRelease: 2003,
020};
021const theFirm = {
022 title: 'The Firm',
023 author: 'John Grisham',
024 yearOfRelease: 1991
025};
026
027console.log(aBook.getYearOfRelease.call(theDaVinciCode));
028
029
030
031console.log(aBook.introduceAuthor('has not written books'));
032
033console.log(aBook.introduceAuthor.call(theFirm, 'has written a total of 100 books'));
034console.log(aBook.introduceAuthor.call(theDaVinciCode, 'is an American author best known for this thriller novels'))
035