001window.onload = ()=>
002{
003 const aBook = {
004 title: null,
005 author: null,
006 yearOfRelease: null,
007 getYearOfRelease() {
008 return this.yearOfRelease;
009 },
010 introduceAuthor(message) {
011 return `${this.author} ${message}`;
012 },
013 };
014
015 const theDaVinciCode = {
016 title: 'The Da Vinci Code',
017 author: 'Dan Brown',
018 yearOfRelease: 2003
019 }
020
021 const theFirm = {
022 title: 'The Firm',
023 author: 'John Grisham',
024 yearOfRelease: 1991
025 }
026
027
028 const boundFunction1 = aBook.getYearOfRelease.bind(theFirm);
029 console.log(boundFunction1());
030 const boundFunction2 = aBook.getYearOfRelease.bind(theDaVinciCode);
031 console.log(boundFunction2());
032}
033