#87 Extract the IDs from the data set
Complete the method so that it returns an array of all ID's passed in. The data structure will be similar to the following:
var data = { id: 1, items: [ {id: 2}, {id: 3, items: [ {id: 4}, {id: 5} ]} ] }
extractIds(data) // should return [1,2,3,4,5]
The method should be able to handle the case of empty data being passed in.
Note: The only arrays that need to be traversed are those assigned to the "items" property.
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #89 Mexican Wave (6kyu) (0) | 2018.07.31 |
---|---|
codewars #88 Which are in? (6kyu) (0) | 2018.07.30 |
codewars #86 Remove Duplicates(7kyu) (0) | 2018.07.26 |
codewars #85 Circularly Sorted Array (6kyu) (0) | 2018.07.25 |
codewars #84Can you get the loop ? (5kyu) (0) | 2018.07.24 |