Skip to content

Latest commit

 

History

History
 
 

README.md

Array Methods

Problem 1. Make person

  • Write a function for creating persons.
    • Each person must have firstname, lastname, age and gender (true is female, false is male)
  • Generate an array with ten person with different names, ages and genders

Problem 2. People of age

  • Write a function that checks if an array of person contains only people of age (with age 18 or greater)
    • Use only array methods and no regular loops (for, while)

Problem 3. Underage people

  • Write a function that prints all underaged persons of an array of person
    • Use Array#filter and Array#forEach
    • Use only array methods and no regular loops (for, while)

Problem 4. Average age of females

  • Write a function that calculates the average age of all females, extracted from an array of persons
    • Use Array#filter
    • Use only array methods and no regular loops (for, while)

Problem 5. Youngest person

  • Write a function that finds the youngest male person in a given array of people and prints his full name
    • Use only array methods and no regular loops (for, while)
    • Use Array#find

Problem 6. Group people

  • Write a function that groups an array of persons by first letter of first name and returns the groups as a JavaScript Object
    • Use Array#reduce
    • Use only array methods and no regular loops (for, while)

Example:

    result = {
        'a': [{
            firstname: 'Asen',
            /* ... */
        }, {
            firstname: 'Anakonda',
            /* ... */
        }],
        'j': [{
            firstname: 'John',
            /* ... */
        }]
    };