🟦 TypeScript Functions

TypeScript functions work like JavaScript’s, but you can explicitly define parameter types and return types for safer, clearer code.

📚 Example Code: Typed Function

Console output will appear here...
đź’ˇ Always declare both parameter and return types to make your functions type-safe.

đź”§ Function Type Syntax

đź“‘ Arrow Functions

TypeScript supports ES6 arrow functions too, with type annotations:

const multiply = (x: number, y: number): number => {
  return x * y;
};

console.log(multiply(3, 5));
  
⚠️ If your function doesn’t return anything, set its return type to void.