diff --git a/11_getTheTitles/getTheTitles.js b/11_getTheTitles/getTheTitles.js index 74b04df..632e3e6 100644 --- a/11_getTheTitles/getTheTitles.js +++ b/11_getTheTitles/getTheTitles.js @@ -1,5 +1,20 @@ -const getTheTitles = function() { +const getTheTitles = function(books) { + //Solution 1: + //return books.map((book) => book.title); + // Solution 3: + return books.map(myFunction); + function myFunction(book){ + return book.title; + } + + // Solution 2: + // let res = []; + // let n = books.length; + // for(let i = 0 ; i< n ;i++){ + // res[i] = books[i].title; + // } + // return res; }; // Do not edit below this line