Created
March 29, 2024 13:04
-
-
Save hakilebara/82f862c17665b244e47c9a263c285a46 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