Types in function arguments and return value. String

suggest change

Example:

function hello(name: string): string {
    return `Hello ${name}!`;
}

Here the syntax name: string means that the function can accept one name argument and this argument can only be string and (...): string { means that the return value can only be a string

Usage:

hello('StackOverflow Documentation') // will be return Hello StackOverflow Documentation!

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents