From 62ea370b9423ee48ad589a61888de0c021cc9818 Mon Sep 17 00:00:00 2001 From: rajroushan6714 Date: Fri, 25 Aug 2023 11:31:56 +0530 Subject: [PATCH] test 11 completed --- 11_getTheTitles/getTheTitles.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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