// Default Parameters sayHello(hello: string = 'hello') { console.log(hello); } sayHello(); // Prints 'hello' sayHello('world'); // Prints 'world'
function sayName({ first, last = 'Smith' }: {first: string; last?: string }): void { const name = first + ' ' + last; console.log(name); } sayName({ first: 'Bob' });