Created
July 17, 2012 13:51
-
-
Save hcmn/3129499 to your computer and use it in GitHub Desktop.
JQuery: Checking for existence & type of callback
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
function mySandwich(param1, param2, callback) { | |
alert('Started eating my sandwich.\n\nIt has: ' + param1 + ', ' + param2); | |
if (callback && typeof(callback) === "function") { | |
callback(); | |
} | |
} | |
mySandwich('ham', 'cheese', 'vegetables'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment