JavaScript Promises

Open the console and review the JS code.

const fetchData = () => {
  const promise = new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve("Data fetched...");
    }, 2000);
  });
  return promise;
};

const logData = (data) => {
  console.log(data);
};

fetchData().then((response) => {
  logData(response);
});