Last active
July 25, 2016 14:06
-
-
Save savelee/30bcb16c8dde1ea6625f3f2ec1759e27 to your computer and use it in GitHub Desktop.
Example default parameters
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
//ES2015 | |
function makeRequest(url, timeout = 2000, callback = function(){}) { | |
//do something | |
} |
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
//ES5 | |
function makeRequest(url, timeout, callback) { | |
timeout = (typeof timeout !== "undefined") ? timeout : 2000; | |
callback = callback || function() {}; | |
//do something | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment