Function Declarations
Function Declaration
π¨βπΌ We need a tiny helper that returns a message to show in the UI. Let's start
with the simplest possible function.
A function declaration looks like this:
function getFavoriteNumber(): number {
return 28
}
π¨ Open
and:
- Create a function declaration named
getMessage - Give it an explicit return type of
string - Return exactly
"Hello, functions!" - Export
getMessage
Required exports
getMessage
Completion criteria
getMessage()returns"Hello, functions!"
π° Remember to return a string and annotate the return type.