Pages

Thursday, June 9, 2016

Problems to solve using Underscore functions

You have an object with a list of names and birthdays.  You want only the names on the list that have birthdays after 2000. Return an array of the names of all the people with birthdays after 2000.

Below is the object =

var dataBase =  {

Sam :1952,
Sara : 1978,
Alice : 1982,
Wyona : 1981,
Bob : 2004,
Chelsea : 2008,
Deborah : 1949,
Katherine : 2001,
Tyler : 1999,
Joel : 1961,
Blaine : 1979,
Rebecca : 1976,
Elvis : 1977,
Jules : 2014,
Flo : 2001,
Wannita : 1941,
"Thema Lou" : 1967,
Andy : 1987,
Barney : 2015,
Otis : 1978,
Helen : 1996,
Jim : 2002,
Dwight : 2008,
Pam : 1956,
Michael : 2005,
Phyllis : 2003,
Stanley : 1975,
Meredith : 1986,
Kevin: 1990,
Angela : 2008,
Ryan : 2002,
Kelly : 1960,
Karen : 1979
};


This is incredible easy to do with _.each.

No comments:

Post a Comment