Multiple Array Methods Practice

You will use multiple array methods to solve these problems. Don't use for loops!

1) Return a list of everyone older than 18 sorted alphabetically by last name.

function sortedOfAge(arr){

}

sortedOfAge([  
  {
    firstName: "Sarah",
    lastName: "Palin",
    age: 47
  },{
    firstName: "Frank",
    lastName: "Zappa",
    age: 12
  },{
    firstName: "Rick",
    lastName: "Sanchez",
    age: 78
  },{
    firstName: "Morty",
    lastName: "Smith",
    age: 13
  },{
    firstName: "Kyle",
    lastName: "Mooney",
    age: 27
  }
]);  

2) Using the same array from the promblem above, return a sorted list, youngest to oldest, of People in <li>s

function toDisplayInHTML(arr){

}

toDisplayInHTML(peopleArray);  //==> ["<li>Rick Sanchez is 78</li>", "<li>Sarah Palin is 47</li>", "<li>Kyle Mooney is 27</li>", "<li>Morty Smith is 13</li>", "<li>Frank Zappa is 12</li>"]

3) Create and array of everyone that has at least one dog and sort it by age.

function sortedDogOwners(arr){

}

sortedDogOwners([  
  {
    firstName: "Sarah",
    lastName: "Palin",
    age: 47,
    pets: ["dog", "cat"]
  },{
    firstName: "Frank",
    lastName: "Zappa",
    age: 12,
    pets: ["dog"]
  },{
    firstName: "Rick",
    lastName: "Sanchez",
    age: 78,
    pets: ["cat", "parrit"]
  },{
    firstName: "Morty",
    lastName: "Smith",
    age: 13,
    pets: ["cat", "parrit", "dog"]
  },{
    firstName: "Kyle",
    lastName: "Mooney",
    age: 27,
    pets: ["dog"]
  }
]) 

4) Create an array of strings of pets first names in <li>s if their owner is older than 20 and all the owners pets have nicknames, and they have at least one dog.

function arbitraryPractice(arr){

};

console.log(arbitraryPractice([  
  {
    firstName: "Sarah",
    lastName: "Palin",
    age: 47,
    pets: [
      {
        name: "Alfred",
        type: "dog",
        nickNames: ["Lil Alfred", "Alfy", "Alfinator"]
      },{
        name: "Charles",
        type: "cat",
        nickNames: ["Charley"]
      },{
        name: "Bark Obama",
        type: "dog",
        nickNames: ["Barack", "Mr. President"]
      },{
        name: "Christopher George Latore Wallace",
        type: "dog",
        nickNames: ["Notorious D.I.G.", "Diggie Smalls"]
      }

    ]
  },{
    firstName: "Frank",
    lastName: "Zappa",
    age: 12,
    pets:  [
      {
        name: "Howard",
        type: "dog",
        nickNames: []
      },{
        name: "Bear",
        type: "dog",
        nickNames: []
      }
    ]
  },{
    firstName: "Rick",
    lastName: "Sanchez",
    age: 78,
    pets:  [
      {
        name: "Bird Person",
        type: "bird",
        nickNames: ["Phoenixperson"]
      },{
        name: "Krombopulos Michael",
        type: "Gromflomite",
        nickNames: ["Assassin man"]
      },{
        name: "Squanchy",
        type: "Cat-person",
        nickNames: ["Squanch", "Smarf", "Thunder Cat"]
      }

    ]
  },{
    firstName: "Morty",
    lastName: "Smith",
    age: 23,
    pets:  [
      {
        name: "Morty Jr.",
        type: "Gazorpazorp",
        nickNames: ["Gwendolyn Jr."]
      },{
        name: "Snuffels",
        type: "dog",
        nickNames: ["Snowball"]
      }

    ]
  }
]));

//should return 

['<li>Alfred</li>',
 '<li>Charles</li>',
 '<li>Bark Obama</li>', 
 '<li>Christopher George Latore Wallace</li>',
 '<li>Morty Jr.</li>', 
 '<li>Snuffels</li>']