forked from denulemos/programming-training
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ejer19.js
35 lines (28 loc) · 879 Bytes
/
ejer19.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
const moviesMock = [
{title: "El señor de los anillos",
directedBy: "Deno Lemon",
seen: true},
{title: "El señor de los anillos 2",
directedBy: "Deno Lemon",
seen: true},
{title: "El señor de los anillos 3",
directedBy: "Deno Lemon",
seen: false},
{title: "High School Musical",
directedBy: "Deno Lemon",
seen: false},
]
const myMovies = (movies) => {
let returnString = ""
for (movie of movies) {
const {seen, title, directedBy} = movie; // Destructuramos los datos
// Mucho de este codigo fue cortesia de Github Copilot
if (seen) {
returnString += `I have seen "${title}" directed by ${directedBy} \n`
} else {
returnString += `I have not seen "${title}" directed by ${directedBy} \n`
}
}
return returnString;
}
module.exports = myMovies;