File tree 3 files changed +50
-0
lines changed
3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Get the Titles!
2
+
3
+ You are given an array of objects that represent books with an author and a title that looks like this:
4
+
5
+ ``` javascript
6
+ const books = [
7
+ {
8
+ title: ' Book' ,
9
+ author: ' Name'
10
+ },
11
+ {
12
+ title: ' Book2' ,
13
+ author: ' Name2'
14
+ }
15
+ ]
16
+ ```
17
+
18
+ your job is to write a function that takes the array and returns an array of titles:
19
+
20
+ ``` javascript
21
+ getTheTitles (books) // ['Book','Book2']
22
+ ```
23
+
24
+ ## Hints
25
+
26
+ - You should use a built-in javascript method to do most of the work for you!
Original file line number Diff line number Diff line change
1
+ const getTheTitles = function ( ) {
2
+
3
+ }
4
+
5
+ module . exports = getTheTitles ;
Original file line number Diff line number Diff line change
1
+ let getTheTitles = require ( './getTheTitles' )
2
+
3
+ describe ( 'getTheTitles' , function ( ) {
4
+ const books = [
5
+ {
6
+ title : 'Book' ,
7
+ author : 'Name'
8
+ } ,
9
+ {
10
+ title : 'Book2' ,
11
+ author : 'Name2'
12
+ }
13
+ ]
14
+
15
+ it ( 'gets titles' , function ( ) {
16
+ expect ( getTheTitles ( books ) ) . toEqual ( [ 'Book' , 'Book2' ] ) ;
17
+ } ) ;
18
+
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments