Added an iterative approach with (for of)

This commit is contained in:
Alejandro Hernandez 2022-09-05 01:38:07 -07:00 committed by GitHub
parent db998d7279
commit 91bd9064d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -3,3 +3,14 @@ const getTheTitles = function(array) {
};
module.exports = getTheTitles;
const getTheTitles = function (array) {
let titles = [];
for (const element of array) titles.push(element.title);
return titles;
};
module.exports = getTheTitles