const arrOfStrings = ['cat', 'wolf', 'yo', 'animal'];-
Exercise 1: Using the array (
arrOfStrings), sort an array from shortest string to the longest. -
Exercise 2: Using the same arr (
arrOfStrings), sort its elements alphabetically. -
Exercise 3: Sort the objects in the array by age, in descending order.
const people = [
{ name: 'Candice', age: 25 },
{ name: 'Tammy', age: 30 },
{ name: 'Allen', age: 49 },
{ name: 'Nettie', age: 21 },
{ name: 'Stuart', age: 17 },
{ name: 'Bill', age: 19 }
];