Created
July 23, 2017 15:17
-
-
Save prof3ssorSt3v3/b8c2f85332746d72648d592891f161ab 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
// Callback functions | |
//built-in callback functions | |
//setTimeout, Arr.forEach, geolocation.getCurrentPosition | |
//make your own callback functions | |
//setTimeout( hello, 2000, 'Bob') | |
let names = ['Inga','Tom','Mattias','Carlos']; | |
names.forEach(hello); | |
navigator.geolocation.getCurrentPosition(gotPosition, positionError, {}); | |
function gotPosition(pos){ | |
} | |
function positionError(err){ | |
} | |
function doThing(other){ | |
let x = 7; | |
//do lots of other things | |
//... | |
let name = 'Steve'; | |
other(name); | |
} | |
function hello(nm, idx, arr){ | |
console.log('hello', nm); | |
} | |
/** | |
doThing(hello); | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment