100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

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

Rating
-
Sold
-
Pages
9
Grade
A+
Uploaded on
23-08-2024
Written in
2024/2025

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) { libraryC({ 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); (libraryCollection);

Show more Read less









Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
August 23, 2024
Number of pages
9
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

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);
```

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LectureLab Teachme2-tutor
View profile
Follow You need to be logged in order to follow users or courses
Sold
626
Member since
1 year
Number of followers
188
Documents
1022
Last sold
1 month ago
LectureLab

LectureLab: Crafted Clarity for Academic Success Welcome to LectureLab, your go-to source for clear, concise, and expertly crafted lecture notes. Designed to simplify complex topics and boost your grades, our study materials turn lectures into actionable insights. Whether you’re prepping for exams or mastering coursework, LectureLab empowers your learning journey. Explore our resources and ace your studies today!

3,6

80 reviews

5
32
4
14
3
16
2
4
1
14

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions