Skip to content

Instantly share code, notes, and snippets.

@eorroe
Created May 5, 2015 23:05
Show Gist options
  • Save eorroe/057197fc672a7bfef856 to your computer and use it in GitHub Desktop.
Save eorroe/057197fc672a7bfef856 to your computer and use it in GitHub Desktop.
Default Parameters
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