Created
November 17, 2021 00:16
-
-
Save KrunchMuffin/991aa999e6d9c35c6d7c8142e01595a0 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
// The second argument/parameter is expected to be a (callback) function | |
const findWaldo = function(names, found) { | |
names.forEach(e => { | |
if (e === 'Waldo') found(); | |
}); | |
}; | |
const actionWhenFound = function() { | |
console.log('Found him!'); | |
}; | |
findWaldo(['Alice', 'Bob', 'Waldo', 'Winston'], actionWhenFound); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment