164k views
5 votes
call the function passing to it a width value of 50 and a length value of 100 storing the return value in dclarea

1 Answer

4 votes

In TypeScript, we must use the ':' symbol just after the function parameter and before the function body to declare the function's return type.

  • In TypeScript, we must use the ':' symbol just after the function's parameter and before the function's body to define the function's return type.If the return value of the function body does not match the function return type, we will get a compile-time error in our code.
  • Before the function's end statement, you must include a return statement followed by the value to be returned.If you do not include a return statement or indicate a value following the keyword return, the function returns an uncertain value.
  • It is not, however, saved.It is actually removed from memory. When we call a function, the function executes its code, and after the return, the function call is removed from working memory ( the browser is in charge of the cleanup task).
User Manisha
by
4.1k points