Created
August 25, 2018 16:41
-
-
Save mojaray2k/a8eb2622d5595edd32b6f5fdacd0eb57 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/diqumox
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
/** Default Function Arguments */ | |
// Example #1 | |
function makeAjaxRequest(url, method = 'GET') { | |
return method; | |
} | |
console.log(makeAjaxRequest('google.com')); | |
// Example #2 | |
function User(id) { | |
this.id = id; | |
} | |
function genereateId () { | |
return Math.random().toString(36).substring(2) + (new Date()).getTime().toString(36); | |
} | |
function createAdminUser(user = new User(genereateId())) { | |
user.admin = true; | |
return user; | |
} | |
function addOffset(style = {offset: '10px'}) { | |
return style; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment