Escribe una función de ordenamiento que recibe un arreglo de nombres y los ordena por apellido, ya sea alfabéticamente (ASC) o en orden alfabético inverso (DESC).
sortContacts([
"John Locke",
"Thomas Aquinas",
"David Hume",
"Rene Descartes"
], "ASC") ➞ [
"Thomas Aquinas",
"Rene Descartes",
"David Hume",
"John Locke"
]
// Aquinas (A) < Descartes (D) < Hume (H) < Locke (L)
sortContacts([
"Paul Erdos",
"Leonhard Euler",
"Carl Gauss"
], "DESC") ➞ [
"Carl Gauss",
"Leonhard Euler",
"Paul Erdos"
]
// Gauss (G) > Euler (EU) > Erdos (ER)
sortContacts([], "DESC") ➞ []
sortContacts(null, "DESC") ➞ []
sortContacts(undefined, "DESC") ➞ []null o undefined, debe devolver un arreglo vacío.