Initial, completed simple book exercise
This commit is contained in:
commit
2327646379
|
@ -0,0 +1,19 @@
|
|||
function Book(title, author, pages, read) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
this.pages = pages;
|
||||
this.read = read;
|
||||
this.info = function() {
|
||||
return `${title} by ${author}, ${pages} pages, ${(read) ? "read" : "not read yet"}`;
|
||||
};
|
||||
}
|
||||
|
||||
const myBook1 = new Book("The Hobbit", "J.R.R. Tolkien", 295, false);
|
||||
const myBook2 = new Book("Pan Tadeusz", "Adam Mickiewicz", 692, true);
|
||||
const myBook3 = new Book("Quo Vadis", "Henryk Sienkiewicz", 563, false);
|
||||
|
||||
console.log(
|
||||
myBook1.info(),
|
||||
myBook2.info(),
|
||||
myBook3.info()
|
||||
)
|
Loading…
Reference in New Issue