Asynchronous JS 03


const animals = ['Dog', 'Cat', 'Mouse', 'Flamingo'];

const randomAnimal = () => {
  return new Promise((resolve, reject) => {
    const randomIndex = Math.floor(Math.random() * animals.length);
    setTimeout(() => resolve(animals[randomIndex]), 500);
  });
};

const double = text => {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(text + ' ' + text), 500);
  });
};

const capitalize = text => {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(text.toUpperCase()), 500);
  });
};

const punctuate = text => {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(text + '!'), 500);
  });
};

const sweetTransformAnimal = async () => {
  let animal = await randomAnimal();
  let doubled = await double(animal);
  let capitalized = await capitalize(doubled);
  let punctuated = await punctuate(capitalized);
  console.log(punctuated);
};

sweetTransformAnimal();

Create a function transformAnimal that is the exact equivalent of the function transformAnimal but without the syntactic sugar keywords async/await. Your function should look like this:

const transformAnimal = () => {
};