// Parameter type annotationfunctiongreet(name:string):string{return name.toUpperCase();}console.log(greet("hello"));// HELLOconsole.log(greet(1));// error, name is typed (string)
// Named functionfunctionadd(x:number, y:number):number{return x + y;}// Anonymous functionletmyAdd=function(x:number, y:number):number{return x + y;};
// define your parameter's type inside the parenthesis// define your return type after the parenthesisfunctionsayHello(name:string):string{console.log(`Hello, ${name}`!);}sayHello('Bob');// Hello, Bob!