Skip to content

Instantly share code, notes, and snippets.

@pinalbhatt
Created April 19, 2014 11:44
Show Gist options
  • Save pinalbhatt/11082031 to your computer and use it in GitHub Desktop.
Save pinalbhatt/11082031 to your computer and use it in GitHub Desktop.
Javascript Function with default parameter value
function foo(age, isValid)
{
a = typeof a !== 'undefined' ? a : 18;
b = typeof b !== 'undefined' ? b : false;
/*
rest function body here
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment