-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (30 loc) · 788 Bytes
/
script.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
//Books Objects Array
const book1 = {
title: "Black Clover",
autor: "Yuki Tabata",
pages: 250,
//Method to resume the book content
resume() {
return `Title: ${this.title}\n Autor: ${this.autor}\n Pages: ${this.pages}\n`;
}
}
const book2 = {
title: "El Quijote",
autor: "Cervantes",
pages: 400,
resume() {
return `Title: ${this.title}\n Autor: ${this.autor}\n Pages: ${this.pages}\n`;
}
}
const book3 = {
title: "Harry Potter",
autor: "J.K.Rowling",
pages: 320,
//Method to resume the book content
resume() {
return `Title: ${this.title}\n Autor: ${this.autor}\n Pages: ${this.pages}\n`;
}
}
//Array of books
const books = [book1, book2, book3];
books.forEach(book => alert(book.resume()))