// Optional Parameters sayHello(hello?: string) { console.log(hello); } sayHello(); // Prints 'undefined' sayHello('world'); // Prints 'world'
// Default Parameters sayHello(hello: string = 'hello') { console.log(hello); } sayHello(); // Prints 'hello' sayHello('world'); // Prints 'world'