1//prototype
2const/let <FunctionName> = (params: type) :<ReturnType> =>{
3 ....
4};
5
6const PrintName = (name: string): string => {
7 return console.log("my name is " , name) ;
8}
1let sum = (x: number, y: number): number => {
2 return x + y;
3}
4
5sum(10, 20); //returns 30
1// ES6: With arrow function
2var getResult = (username: string, points: number): string => {
3 return `${ username } scored ${ points } points!`;
4};
5
6getResult('joyous jackal' , 100);