My App
Phase 3 — Functions

Phase 3 — Functions

Goals for this phase, and a full JS/TS → Python cheat sheet

Estimated time: ~1 hour.

Goals

By the end of this phase you should be comfortable with:

  • parameters
  • return
  • default parameters
  • keyword arguments
  • type hints
  • *args
  • **kwargs basics

Type hints are especially important here — FastAPI reads them to validate requests and generate docs automatically, so getting comfortable with them now pays off later.

Each topic is its own page in the sidebar, taught with a JS/TS → Python comparison, followed by a small example.

Cheat sheet

JavaScript / TypeScript                       Python
────────────────────────────────────────────────────────────
function add(a, b) {                          def add(a, b):
  return a + b;                                   return a + b
}

function add(a = 1) { }                        def add(a=1):

function add(...rest) { }                      def add(*args):

function add({ ...obj }) { }                   def add(**kwargs):

function add(a: number, b: number): number {   def add(a: int, b: int) -> int:
  return a + b;                                    return a + b
}

On this page