100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
IRM4724 Assignment 4 2024 Due 5 September 2024 (Detailed solution) $2.81   Add to cart

Exam (elaborations)

IRM4724 Assignment 4 2024 Due 5 September 2024 (Detailed solution)

 22 views  0 purchase
  • Course
  • Institution

Question 1: Write a JavaScript function to add the following books in the library collection for author John Grisham (30 Marks) To begin, we'll create a JavaScript function to add books to the library collection. We will use an array to store the books, where each book is represented by an obj...

[Show more]

Preview 2 out of 9  pages

  • August 23, 2024
  • 9
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
avatar-seller
IRM4724


Assignment 4


2024

, Question 1: Write a JavaScript function to add the following books in the
library collection for author John Grisham (30 Marks)


To begin, we'll create a JavaScript function to add books to the library collection. We will use an
array to store the books, where each book is represented by an object containing the title, author,
and year of publication.



```javascript
// Initialize the library collection as an empty array
let libraryCollection = [];

// Function to add a book to the library collection
function addBook(title, author, year) {
libraryCollection.push({ title: title, author: author, year:
year });
}

// Add books by John Grisham to the library collection
addBook("A Time to Kill", "John Grisham", 1989);
addBook("The Firm", "John Grisham", 1991);
addBook("The Pelican Brief", "John Grisham", 1992);
addBook("The Client", "John Grisham", 1993);
addBook("The Chamber", "John Grisham", 1994);
addBook("The Rainmaker", "John Grisham", 1995);
addBook("The Runaway Jury", "John Grisham", 1996);
addBook("The Partner", "John Grisham", 1997);
addBook("The Street Lawyer", "John Grisham", 1998);
addBook("The Testament", "John Grisham", 1999);
addBook("The Brethren", "John Grisham", 2000);
addBook("A Painted House", "John Grisham", 2001);
addBook("Skipping Christmas", "John Grisham", 2001);
addBook("The Summons", "John Grisham", 2002);
addBook("The King of Torts", "John Grisham", 2003);
addBook("Bleachers", "John Grisham", 2003);
addBook("The Last Juror", "John Grisham", 2004);
addBook("The Broker", "John Grisham", 2005);
addBook("Playing for Pizza", "John Grisham", 2007);
addBook("The Appeal", "John Grisham", 2008);
addBook("The Associate", "John Grisham", 2009);
addBook("The Confession", "John Grisham", 2010);
addBook("The Litigators", "John Grisham", 2011);
addBook("Calico Joe", "John Grisham", 2012);
addBook("The Racketeer", "John Grisham", 2012);
addBook("Sycamore Row", "John Grisham", 2013);
addBook("Gray Mountain", "John Grisham", 2014);

console.log(libraryCollection);
```

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller GeniusGears. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.81. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

82871 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$2.81
  • (0)
  Add to cart