Consider the following interface and function:
interface Person {
readonly firstname: string;
middlename?: string;
surname: string;
}
function getFullName(p: Person): string {
if (p.middlename !== null && p.middlename !== undefined)
{
if (p.firstname !== null && p.firstname !== undefined)
{
return `${p.firstname} ${p.middlename} ${p.surname}`;
}
else
{
return `${p.middlename} ${p.surname}`;
}
}
else
{
return `${p.firstname} ${p.surname}`;
}
}
Which of the following code snippets will output "John Doe"? Select all that apply.
Select one or more of the following: