Created
February 19, 2024 13:02
-
-
Save hakilebara/3aea086e9bc33770890da9f1ab5a2779 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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