I supplied a parameter called array

I use .map method to map the book to the title.
This commit is contained in:
Isah Jacob 2022-10-31 21:59:13 +01:00
parent 16b15bbc9e
commit 879d67a4b2
1 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,17 @@
const getTheTitles = function() {
const getTheTitles = function(array) {
return array.map(book => book.title)
};
const books = [
{
title: 'Book',
author: 'Name'
},
{
title: 'Book2',
author: 'Name2'
}
]
// Do not edit below this line
module.exports = getTheTitles;