Created
August 4, 2016 23:32
-
-
Save anonymous/4aa53c4aa84c34dcd6c37424f92cb6c4 to your computer and use it in GitHub Desktop.
Blast off, callback ex // source http://jsbin.com/bidoca
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Blast off, callback ex</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var blastOff = function(destination) { | |
console.log("Blasting off for " + destination + "!"); | |
} | |
function makeRocketLauncher(rocketName, blastOffCallback) { | |
return function(planet) { | |
console.log("Launching " + rocketName); | |
console.log("3... 2... 1..."); | |
blastOffCallback(planet); | |
}; | |
} | |
var launchViking = makeRocketLauncher("Viking", blastOff); | |
// var launchMariner = makeRocketLauncher("Mariner", blastOff); | |
launchViking("venus"); | |
//launchMariner(); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> var blastOff = function(destination) { | |
console.log("Blasting off for " + destination + "!"); | |
} | |
function makeRocketLauncher(rocketName, blastOffCallback) { | |
return function(planet) { | |
console.log("Launching " + rocketName); | |
console.log("3... 2... 1..."); | |
blastOffCallback(planet); | |
}; | |
} | |
var launchViking = makeRocketLauncher("Viking", blastOff); | |
// var launchMariner = makeRocketLauncher("Mariner", blastOff); | |
launchViking("venus"); | |
//launchMariner();</script></body> | |
</html> |
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
var blastOff = function(destination) { | |
console.log("Blasting off for " + destination + "!"); | |
} | |
function makeRocketLauncher(rocketName, blastOffCallback) { | |
return function(planet) { | |
console.log("Launching " + rocketName); | |
console.log("3... 2... 1..."); | |
blastOffCallback(planet); | |
}; | |
} | |
var launchViking = makeRocketLauncher("Viking", blastOff); | |
// var launchMariner = makeRocketLauncher("Mariner", blastOff); | |
launchViking("venus"); | |
//launchMariner(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment