Skip to content

Instantly share code, notes, and snippets.

Created August 2, 2016 23:42
Show Gist options
  • Save anonymous/545ee17f40f2228a11f54809d37697b0 to your computer and use it in GitHub Desktop.
Save anonymous/545ee17f40f2228a11f54809d37697b0 to your computer and use it in GitHub Desktop.
anon functions 1 // source http://jsbin.com/someji
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>anon functions 1</title>
</head>
<body>
<script id="jsbin-javascript">
var blastOff = function(destination) {
console.log("Blasting off! Headed to: " + destination);
};
var stopIgnition = function() {
console.log("we have a problem");
};
function launchRocket(rocketName, blastOffCallback) {
console.log("Launching " + rocketName);
console.log("3... 2... 1...");
blastOffCallback('Mars');
}
launchRocket("Viking", blastOff);
launchRocket("Viking", stopIgnition);
// => Launching Viking
// => 3... 2... 1...
// => Blasting off!
</script>
<script id="jsbin-source-javascript" type="text/javascript">
var blastOff = function(destination) {
console.log("Blasting off! Headed to: " + destination);
};
var stopIgnition = function() {
console.log("we have a problem");
};
function launchRocket(rocketName, blastOffCallback) {
console.log("Launching " + rocketName);
console.log("3... 2... 1...");
blastOffCallback('Mars');
}
launchRocket("Viking", blastOff);
launchRocket("Viking", stopIgnition);
// => Launching Viking
// => 3... 2... 1...
// => Blasting off!</script></body>
</html>
var blastOff = function(destination) {
console.log("Blasting off! Headed to: " + destination);
};
var stopIgnition = function() {
console.log("we have a problem");
};
function launchRocket(rocketName, blastOffCallback) {
console.log("Launching " + rocketName);
console.log("3... 2... 1...");
blastOffCallback('Mars');
}
launchRocket("Viking", blastOff);
launchRocket("Viking", stopIgnition);
// => Launching Viking
// => 3... 2... 1...
// => Blasting off!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment