Skip to content

Instantly share code, notes, and snippets.

@hakilebara
Created February 19, 2024 13:02
Show Gist options
  • Save hakilebara/3aea086e9bc33770890da9f1ab5a2779 to your computer and use it in GitHub Desktop.
Save hakilebara/3aea086e9bc33770890da9f1ab5a2779 to your computer and use it in GitHub Desktop.
function fetchData(callback) {
// Simulating an API call with setTimeout:
setTimeout(() => {
console.log("Data fetched");
callback("Sample data");
}, 1000);
}
function processData() {
console.log("Processing data...");
fetchData(data => {
console.log("Data processed:", data);
});
console.log("Data processing complete");
}
processData();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment