-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathobjects.js
103 lines (95 loc) · 2.29 KB
/
objects.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* createBook
*
* - receives data about the book
* - returns an object created using curly braces {}
* that includes the following format:
*
* - title: "JavaScript: The Definitive Guide"
* - author: "David Flanagan"
* - publishedYear: 2020
* - genre: "Programming"
*/
function createBook(title, author, publishedYear, genre) {
// write your code here...
}
// DO NOT CHANGE THE LINE OF CODE BELOW (you can use it for testing your code)
const book = createBook();
/**
* printBookTitleAndYear
*
* - receives a book object (just like the one created by `createBook`)
* - returns the book’s title with its publish year separated by a space.
*
* Access the book title using dot-notation, and access the publish year using bracket-notation.
*/
function printBookTitleAndYear(book) {
// write your code here...
}
/**
* addPageCount
*
* - receives a book object
* - received a pageCount
* - returns the book object with a new `pageCount` property
*/
function addPageCount(book, pageCount) {
// write your code here...
}
/**
* addISBN
*
* - receives a book object
* - receives an ISBN
*
* - returns the book object with a new `ISBN` property
*/
function addISBN(book, ISBN) {
// write your code here...
}
/**
* updatePublishedYear
*
* - receives a book object
* - received newYear, the new publishing year
*
* - returns the book object with the `publishedYear` updates
*/
function updatePublishedYear(book, newYear) {
// write your code here...
}
/**
* addSecondAuthor
*
* - receives a book object
* - receives an additional author
*
* - returns the book object with the `author` property changed to an array with BOTH authors
*/
function addSecondAuthor(book, additionalAuthor) {
// write your code here...
}
/**
* 🌶️🌶️🌶️ addReview
*
* - receives a book object which MIGHT have a reviews property
* - receives a reviewer
* - receives a comment
*
* Create a new review object made up of a `reviewer` and `comment`
* and add it to the book's reviews array
*
* - returns the book object with the new review included in the reviews array
*/
function addReview(book, reviewer, comment) {
// write your code here
}
module.exports = {
createBook,
printBookTitleAndYear,
addPageCount,
addISBN,
updatePublishedYear,
addSecondAuthor,
addReview,
};