Created
May 5, 2015 23:05
-
-
Save eorroe/057197fc672a7bfef856 to your computer and use it in GitHub Desktop.
Default Parameters
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
function foo(a=5) { | |
console.log(a); | |
} | |
a() //This should log 5 | |
a(undefined) //This should log undefined what's the point of passing undefined if passing nothing does the same | |
function foo2(a=5, b=10) { | |
console.log(a, b); | |
} | |
foo2(,undefined) //This should be possible and log 5, undefined | |
//Sorry Correct me if this has been discussed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment