Added an iterative approach with (for of)
This commit is contained in:
parent
db998d7279
commit
91bd9064d1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue