6 kyu
Extract the IDs from the data set
1,514 of 2,226jhoffner
Description:
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.
Arrays
Algorithms
Similar Kata:
Stats:
Created | Mar 31, 2013 |
Published | Apr 2, 2013 |
Warriors Trained | 4574 |
Total Skips | 829 |
Total Code Submissions | 17345 |
Total Times Completed | 2226 |
JavaScript Completions | 1514 |
Ruby Completions | 605 |
CoffeeScript Completions | 111 |
Total Stars | 85 |
% of votes with a positive feedback rating | 89% of 257 |
Total "Very Satisfied" Votes | 214 |
Total "Somewhat Satisfied" Votes | 31 |
Total "Not Satisfied" Votes | 12 |