32 lines
493 B
JavaScript
32 lines
493 B
JavaScript
|
|
const films = [
|
|
{
|
|
titre: "bloodpsort",
|
|
année: 1997
|
|
},
|
|
{
|
|
titre: "die hard",
|
|
année: 1999,
|
|
acteurCelebre: "Bruce willis"
|
|
}]
|
|
|
|
console.log(films)
|
|
console.log(films[0])
|
|
console.log(films.map(film => {
|
|
return {
|
|
...film,
|
|
titreAvecActeur: film.acteurCelebre ? `${film.titre} avec ${film.acteurCelebre}` : undefined
|
|
}
|
|
}))
|
|
|
|
const new_film = {
|
|
titre: "thunderman",
|
|
année: 2025
|
|
}
|
|
|
|
|
|
console.log([...films, new_film])
|
|
|
|
films.push(new_film)
|
|
console.log(films)
|