Skip to content

Instantly share code, notes, and snippets.

@DevGW
Last active April 5, 2023 14:45
Show Gist options
  • Save DevGW/dcb34ea0c6692489c1ab2f403b3f706e to your computer and use it in GitHub Desktop.
Save DevGW/dcb34ea0c6692489c1ab2f403b3f706e to your computer and use it in GitHub Desktop.
Javascript :: using backticks to write Javascript #js
// function defaultGreet(first, last) {
// if (last !== undefined) {
// return 'Hi ' + first + ' ' + last + '!';
// } else {
// last = ' Doe!';
// return 'Hi ' + first + last;
// }
// }
// defaultGreet('Jane');
const defaultGreet = (firstName, lastName = 'Doe') => `Hi ${firstName} ${lastName}!`;
// much more concise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment