Skip to content

Instantly share code, notes, and snippets.

@prof3ssorSt3v3
Created July 23, 2017 16:09
Show Gist options
  • Save prof3ssorSt3v3/9ee7efa0d5b7f8ef4cd9f4c9c8c3d817 to your computer and use it in GitHub Desktop.
Save prof3ssorSt3v3/9ee7efa0d5b7f8ef4cd9f4c9c8c3d817 to your computer and use it in GitHub Desktop.
// Default Function Parameters
// new ES6 feature allowing us to provide
//default values for function parameters
function sendMessage(email, message, title="message"){
if(!email || !message){
return false;
}
//title = title || "";
//fancy code to send the message
title = title.toUpperCase();
console.log(title);
console.log(message, '\n');
return true;
}
sendMessage('fry@planetexpress.org',
'You got the raise!',
'Good news!');
sendMessage('fry@planetexpress.org',
'nvm. My mistake. It was Scruffy who got the raise.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment