Skip to content

Merge Changes #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Day7/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,27 @@ console.log(book);
// Task 2: Access and log the `title` and `author` properties of the book object.

console.log("The title of the Book is:- " + book.title);
console.log("The author of the book is:- " + book.author);
console.log("The author of the book is:- " + book.author);

console.log("-------------------------------------------------");
console.log("Activity 2: ");

// 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.

book.bookDetails = function() {
return `The book ${this.title} is written by ${this.author}.`;
};

console.log(book.bookDetails());

// 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.

book.updateYear = function(year) {
this.year = year;
return this;
};

console.log(book.updateYear("2021"));

console.log("-------------------------------------------------");
console.log("Activity 3: ");