Skip to content

Instantly share code, notes, and snippets.

@chadsten
Last active June 16, 2017 18:36
Show Gist options
  • Save chadsten/c471c914655f8ac00b9658ee72f57584 to your computer and use it in GitHub Desktop.
Save chadsten/c471c914655f8ac00b9658ee72f57584 to your computer and use it in GitHub Desktop.
function myFunction() {
// no arguments present
console.log('Hellow World');
}
myfunction(); // shows Hello World in the console
function myFunction(message) {
// one arguments present
console.log(message);
}
myfunction('Hello World'); // shows Hello World in the console
function myFunction(message = 'Hello World') {
// one arguments present
console.log(message);
}
myfunction(); // shows Hello World in the console
myfunction('Hello Austin!'); // shows Hello Austin! in the console
function myFunction(message, time) {
// two arguments present
if (time == now) {
console.log(message);
} else {
console.log('It is not time yet.');
}
}
myfunction('Hello World', 'now'); // shows Hello World in the console
myfunction('Hello World', 'later'); // shows It is not time yet. in the console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment