Languages
[Edit]
EN

TypeScript - create and use functions

0 points
Created by:
Paluskitten
356

In TypeScript it is possible to create and use functions in few ways.

1. Function function / class example

Edit

Output (with NodeJS):

2. Anonymous function example

Edit

2.1. With function name from constiable name

Edit

Output (with NodeJS):

2.2. With own function name

Edit

Output (with NodeJS):

3. Arrow function example

Edit

Arrow function has been introduced in ES6. This part shows in simple way how to use arrow functions.

3.1. With function body in brackets

Output (with NodeJS):

3.2. Without brackets - with auto-returning of values

Output (with NodeJS):

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join