6 kyu
CoffeeScript Comprehensions
305 of 322jhoffner
Description:
CoffeeScript includes the ability to loop over arrays and perform each/select/map type behavior. It provides this without the need to use an external library such as underscore.js.
Utilize the comprehension syntax in the following exercise. The findFirstNames(data, lastNameLength) method needs to be completed so that it will return the first names of people who have a last name with a string length equivalent to the lastNameLength argument.
The following is an example dataset:
people = [
{firstName: 'Bill', lastName: 'Gates'},
{firstName: 'Steve', lastName: 'Jobs'},
{firstName: 'Brendan', lastName: 'Eich'},
{firstName: 'Yukihiro', lastName: 'Matsumoto'},
{firstName: 'Jeremy', lastName: 'Ashkenas'}
]
The method would be called like the following:
firstNames = findFirstNames(people, 4)
# firstNames would == ['Steve', 'Brendan']
Arrays
Fundamentals
Similar Kata:
Stats:
Created | Mar 12, 2013 |
Published | Mar 13, 2013 |
Warriors Trained | 485 |
Total Skips | 38 |
Total Code Submissions | 1332 |
Total Times Completed | 322 |
CoffeeScript Completions | 305 |
Total Stars | 3 |
% of votes with a positive feedback rating | 85% of 40 |
Total "Very Satisfied" Votes | 29 |
Total "Somewhat Satisfied" Votes | 10 |
Total "Not Satisfied" Votes | 1 |