Skip to content

Instantly share code, notes, and snippets.

@varemenos
Created February 27, 2012 03:53
Show Gist options
  • Save varemenos/1921214 to your computer and use it in GitHub Desktop.
Save varemenos/1921214 to your computer and use it in GitHub Desktop.
jQuery - Optional parameters and typeof variable
x('4');
function x(i){
if(typeof i === 'undefined'){
console.log('i : undefined');
}else{
console.log('i : ' + i);
console.log('typeof ' + typeof i);
}
}
// output
// i = 4
// typeof string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment