Return types
A function can produce an output value with a return
statement.
Once the return statement is performed, no further instructions in the function are evaluated. The return value is used as the computed result of the function call.
Loading TypeScript...
There are multiple ways to fix the program below so the race finishers are printed in the correct order.
Loading TypeScript...
If a function parameter has multiple possible data types, TypeScript will try to infer a more specific data type when
an if
, else if
, and else
statements is used within the function.
Loading TypeScript...
Loading TypeScript...
We could fix the code above.
Loading TypeScript...