From b552c0eabb0063d7f196b23c4f465ba2744d62a6 Mon Sep 17 00:00:00 2001 From: LoptrSir <91218015+LoptrSir@users.noreply.github.com> Date: Thu, 28 Apr 2022 12:15:01 -0700 Subject: [PATCH] debug += concatenate --- 11_getTheTitles/getTheTitles.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/11_getTheTitles/getTheTitles.js b/11_getTheTitles/getTheTitles.js index b804f6f..361e75f 100644 --- a/11_getTheTitles/getTheTitles.js +++ b/11_getTheTitles/getTheTitles.js @@ -1,8 +1,22 @@ -const getTheTitles = function(dict) { - result = Object.keys(dict); - console.log(result); - return result; - // test tested retest -}; +const getTheTitles = function (dicts) { + let title = []; + dicts.forEach((dict) => { + for (const ttl in dict) { + if (ttl === "title") title += dict[ttl]; + } + }); + console.log(title); + }; + + getTheTitles([ + { + title: "Book", + author: "Name", + }, + { + title: "Book2", + author: "Name2", + }, + ]);