I supplied a parameter called array
I use .map method to map the book to the title.
This commit is contained in:
parent
16b15bbc9e
commit
879d67a4b2
|
@ -1,6 +1,17 @@
|
||||||
const getTheTitles = function() {
|
const getTheTitles = function(array) {
|
||||||
|
return array.map(book => book.title)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const books = [
|
||||||
|
{
|
||||||
|
title: 'Book',
|
||||||
|
author: 'Name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Book2',
|
||||||
|
author: 'Name2'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
module.exports = getTheTitles;
|
module.exports = getTheTitles;
|
||||||
|
|
Loading…
Reference in New Issue