$(document).ready(function() {
const fetchData = () => {
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("Loose Cannon Fitness");
}, 100);
});
return promise;
};
setTimeout(() => {
console.log("Smith and Gone");
fetchData()
.then(text => {
console.log(text);
});
}, 200);
});
As always, thank you for a thorough explanation!
What you've got works, but I've got one more related question and let me qualify it by saying that at this point, it's not about practical application as much as it's for my own edification.
Could I write "fetchData" as an anonymous function? Not that I would necessarily do that in a practical setting, but I was curious.
You'll find that question at https://www.experts-exchange.com/questions/29172470/Can-This-Code-Work-Using-an-Anonymous-Function.html
As always, thank you for your time, bud!