Created
January 9, 2019 00:30
-
-
Save robertcoopercode/addd473ed24ca8d5560348fddd49cf3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Optional function parameter | |
function callMom(message?: string) { | |
if (!message) { | |
console.log('Hi mom. Love you. Bye.'); | |
} else { | |
console.log(message); | |
} | |
} | |
// Interface describing an object containing an optional property | |
interface Person { | |
name: string; | |
age: number; | |
favoriteColor?: string; // This property is optional | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment