TS - Functions with optional parameters.

by Rodwyn Moreno

TypeScript

function fullName( name:string, lastName?:string ):string {
	return ( lastName ) ? name + ' ' + lastName : name;
}

let name = fullName("Mateo");

console.log(name);