Update getTheTitles.js

added solution
This commit is contained in:
Julian So 2023-01-14 11:12:15 -05:00 committed by GitHub
parent 8746ce056a
commit 4fba21edb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,21 @@
const getTheTitles = function () {
const books = [
{
title: "Book",
author: "Name",
},
{
title: "Book2",
author: "Name2",
},
];
let titles = [];
books.forEach((book) => {
titles.push(book.title);
});
return titles;
};
// Do not edit below this line