LOGIC with TS
10 TypeScript lessons with editable examples and exercises. Start with the first.
1What is an algorithm
Turn a problem into clear steps and give types to the inputs and output.2Variables and types
Use let and const with type annotations, inference and the number | string | boolean union.3Operators and expressions
Do math, compare values and combine typed boolean conditions with && and ||.4Decisions
Choose paths with if/else and switch and restrict answers with literal and union types.5Loops: times tables and FizzBuzz
Repeat steps with for and while using typed counters, and solve FizzBuzz.6Functions
Write typed signatures: parameters, return types and optional parameters.7Arrays: loop, sum and find the largest
Use typed arrays, loop with for...of and handle empty lists with number | null.8Objects: a student and grades
Describe an object's shape with an interface and combine objects, arrays and functions.9Debugging and edge cases
See which mistakes the type checker catches, read console errors and fix an off-by-one loop.10Final project: average calculator
Combine interfaces, literal types, typed functions, loops and decisions in a testable report card.
Turn a problem into clear steps and give types to the inputs and output.2Variables and types
Use let and const with type annotations, inference and the number | string | boolean union.3Operators and expressions
Do math, compare values and combine typed boolean conditions with && and ||.4Decisions
Choose paths with if/else and switch and restrict answers with literal and union types.5Loops: times tables and FizzBuzz
Repeat steps with for and while using typed counters, and solve FizzBuzz.6Functions
Write typed signatures: parameters, return types and optional parameters.7Arrays: loop, sum and find the largest
Use typed arrays, loop with for...of and handle empty lists with number | null.8Objects: a student and grades
Describe an object's shape with an interface and combine objects, arrays and functions.9Debugging and edge cases
See which mistakes the type checker catches, read console errors and fix an off-by-one loop.10Final project: average calculator
Combine interfaces, literal types, typed functions, loops and decisions in a testable report card.