Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

nullable parameter typescript

const sayHello = (name: string, age?: Number): string => {
	if(age) return `Hello ${name}! You are ${age} years old.`;
	else return `Hello ${name}! How old are you?`;
}
 
PREVIOUS NEXT
Tagged: #nullable #parameter #typescript
ADD COMMENT
Topic
Name
1+6 =