In this video we're going to take a look at some alternate forms of syntax around annotations for functions.
So underneath my two functions I already have I'm going to define a another one called divide and you'll
notice I'm going to use the keyword function right here.
So how do we use these annotations with a function defined with the function keyword.
Well basically the exact same way.
So we'll have two arguments A and B and we need to annotate both them.
So we'll say A is going to be a number and B is going to be a number as well.
Then to annotate the return type of this again right after the argument list will put in a colon and
then the type of value we expect to return.
Then we can return a divided by B.
Like so now this syntax is going to also work for anonymous functions assigned to variables too.
So I could say const multiply will be a function.
This will take two arguments of A and B.
Once again both numbers and again right after that argument list we can annotate the return type as
well.
And so then inside the function A times B like so.
And that's pretty much it so anytime that we need to define a function using an arrow a named function
or an anonymous function assigned to a variable we're always going to see a near identical form of syntax
it's always going to be the arguments that the colon and then the expected type.
And then immediately after the closing parentheses we'll do another colon and the expected type of the
return value from the function.
That's pretty much it.
Quick pause here and we'll talk about one less thing in the next video.