Pages

Friday, June 10, 2016

Code problem to solve using Underscore functions

Take an array of names, and return a new array with only those names that are longer than 5 letters.


To make it a bit more complicated, I will use this array of objects, and will return just a single array with the correct names in it.  Also, the function you build should be adjustable as to the length the names need to be.  For example, it should accept two arguments, on is the array, and the other is the minimum length of letters the name needs to be  :

[ { Alice: '', Bob: '', Chelsea: '', Deborah: '', Katherine: '', Joel: '', Blaine: '', Elvis: '', Jules: '', Flo: '', Andy: '', Barney: '', Helen: '', Jim: '', Dwight: '', Michael: '', Meredith: '', Kevin: '', Angela: '', Kelly: '', Karen: '' }, { Sam: '', Sara: '', Wyona: '', Tyler: '', Rebecca: '', Wannita: '', 'Thema Lou': '', Otis: '', Pam: '', Phyllis: '', Stanley: '', Ryan: '' } ]

No comments:

Post a Comment