Skip to content

Commit 3fc0e0b

Browse files
Merge pull request #14 from yashksaini-coder/main
Merge Changes Co-authored-by: Garv Saini <garvkumarsaini@gmail.com>
2 parents 7f6d31a + 678a0e0 commit 3fc0e0b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Day7/index.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,27 @@ console.log(book);
1313
// Task 2: Access and log the `title` and `author` properties of the book object.
1414

1515
console.log("The title of the Book is:- " + book.title);
16-
console.log("The author of the book is:- " + book.author);
16+
console.log("The author of the book is:- " + book.author);
17+
18+
console.log("-------------------------------------------------");
19+
console.log("Activity 2: ");
20+
21+
// Task 3: Add a method to the book object that returns a string with the book's title and author, and log the result of calling this method.
22+
23+
book.bookDetails = function() {
24+
return `The book ${this.title} is written by ${this.author}.`;
25+
};
26+
27+
console.log(book.bookDetails());
28+
29+
// Task 4: Add a method to the book object that takes a parameter (year) and updates the book's year property, then log the updated object.
30+
31+
book.updateYear = function(year) {
32+
this.year = year;
33+
return this;
34+
};
35+
36+
console.log(book.updateYear("2021"));
37+
38+
console.log("-------------------------------------------------");
39+
console.log("Activity 3: ");

0 commit comments

Comments
 (0)