From 879d67a4b28001747c108411a185d036fc6492ae Mon Sep 17 00:00:00 2001 From: Isah Jacob Date: Mon, 31 Oct 2022 21:59:13 +0100 Subject: [PATCH] I supplied a parameter called array I use .map method to map the book to the title. --- 11_getTheTitles/getTheTitles.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/11_getTheTitles/getTheTitles.js b/11_getTheTitles/getTheTitles.js index 74b04df..6dcf457 100644 --- a/11_getTheTitles/getTheTitles.js +++ b/11_getTheTitles/getTheTitles.js @@ -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;