Merge pull request #15 from BillalPatel/get-the-titles

Improved answer
This commit is contained in:
Billal Patel 2019-11-08 17:13:40 +00:00 committed by GitHub
commit b8baa269d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -1,11 +1,7 @@
const getTheTitles = function(books) { const getTheTitles = function(books) {
let bookTitles = []; const mappedBooks = books.map(book => book.title);
books.forEach((book) => { return mappedBooks;
bookTitles.push(book.title);
})
return bookTitles;
} }
module.exports = getTheTitles; module.exports = getTheTitles;