Created
March 29, 2024 13:05
-
-
Save hakilebara/567ee61c62c7607a5a1209eb5670775b to your computer and use it in GitHub Desktop.
This file contains 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