Created
March 23, 2016 13:17
-
-
Save leoallen85/87b2aa2caeb66319ed94 to your computer and use it in GitHub Desktop.
Exercises for understanding asynchronous JS and callbacks.
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
// Callbacks | |
// Complete this function so that it passes the numbers 1 and 2 into the callback | |
function two_numbers(callback){ | |
// TODO | |
} | |
two_numbers(function(x, y){ | |
console.log(x, y); | |
} | |
// Async and callbacks | |
// Complete this function using setTimeout to only pass the message to the callback | |
// after the defined delay | |
function afterTimeout(message, delay, callback) { | |
// TODO | |
} | |
function afterTimeout("hello world", 1000, function(message){ | |
console.log(message); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment