Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript function

// Parameter type annotation
function greet(name: string): string {
 return name.toUpperCase();
}

console.log(greet("hello"));		// HELLO
console.log(greet(1));				// error, name is typed (string)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #function
ADD COMMENT
Topic
Name
1+5 =