Skip to content

Instantly share code, notes, and snippets.

@amberlex78
Created April 7, 2024 15:33
Show Gist options
  • Save amberlex78/f03753fbd168b6496a55bffd88ca21e5 to your computer and use it in GitHub Desktop.
Save amberlex78/f03753fbd168b6496a55bffd88ca21e5 to your computer and use it in GitHub Desktop.
function greet(person: string, date: Date): void {
console.log(`Hello, ${person}! Today is ${date.toDateString()}.`);
}
const getFullName = (first: string, last?: string): string =>
last ? `${first} ${last}` : `${first}`;
let fullName = getFullName("John");
greet(fullName, new Date());
fullName = getFullName("John", "Doe");
greet(fullName, new Date());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment