/**
* TODO:
* Buatlah variabel greatAuthors yang merupakan array
* berdasarkan hasil filter() dan map() dari books:
* - Gunakan fungsi filter untuk mengembalikan nilai item books
* yang hanya memiliki nilai sales lebih dari 1000000.
* - Gunakan fungsi map pada books yang sudah ter-filter,
* untuk mengembalikan nilai string dengan format:
* - `${author} adalah penulis buku ${title} yang sangat hebat!`
*
* Catatan: Jangan ubah nilai atau struktur dari books
*/
const books = [
{ title: 'The Da Vinci Code', author: 'Dan Brown', sales: 5094805 },
{ title: 'The Ghost', author: 'Robert Harris', sales: 807311 },
{ title: 'White Teeth', author: 'Zadie Smith', sales: 815586 },
{ title: 'Fifty Shades of Grey', author: 'E. L. James', sales: 3758936 },
{ title: 'Jamie\'s Italy', author: 'Jamie Oliver', sales: 906968 },
{ title: 'I Can Make You Thin', author: 'Paul McKenna', sales: 905086 },
{ title: 'Harry Potter and the Deathly Hallows', author: 'J.K Rowling', sales: 4475152 },
];
// TODO
const greatAuthors = books.filter((book) => book.sales > 1000000).map((book) => {
const {author, title} = book;
return `${author} adalah penulis buku ${title} yang sangat hebat!`
});
console.log(greatAuthors);
/**
* Jangan hapus kode di bawah ini
*/
module.exports = { books, greatAuthors };