Search
Lessons (40)
- Small Functions That Do One Thing
Short, focused functions are easy to name, test and reuse. Learn how to spot a function doing too …
- JavaScript Essentials: Event Loop, Closures & this
… Closures The big idea A function is like a backpack traveller : wherever it goes, it carries a backpack …
- Serverless Architecture
… you write functions, the cloud runs them when an event happens , scales them automatically (even to zero), and …
- Event-Driven Patterns, Step Functions and Reliable Lambdas
… See [Step Functions error handling](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html …
- Count, for_each, Functions, and Stable Identities
… Further reading: [for each](https://developer.hashicorp.com/terraform/language/meta-arguments/for each), [functions](https://developer.hashicorp …
- TypeScript Essentials
… They're erased from the output, so TypeScript adds zero runtime cost. ts function total(price: number, quantity …
- JavaScript Language Fundamentals
… A function that takes or returns a function is a higher-order function . js const once = (fn) = { let …
- Comments & Formatting
… Lying (outdated) comments js // Returns the price in dollars ← written 2 years ago function getPrice(item) { return item …
- What Is Object-Oriented Programming?
… data and functions are separate const account = { owner: "Ana", balance: 100 }; function withdraw(acc: { balance: number }, amount: number …
- React Hooks in Practice
… never inside if , loops or nested functions. 2. Only call hooks from React functions (components or custom hooks …
- Code Smells & Refactoring
… they prove behaviour didn't change. The smell catalogue Smell Looks like Fix (refactoring) --- --- --- --- 1 Long function 80 …
- Serverless: Lambda and API Gateway
… Use the handler name lambda function.lambda handler and save this as lambda function.py : python import json …
- Hash Maps & Sets
… A hash function turns a key (like "apple" ) into a number (a bucket index), so the computer jumps …
- TypeScript in Practice
… placeholders filled in when the function is used. ts // T is "whatever the array holds" function first<T …
- Recursion & Backtracking
A function that calls itself to solve smaller copies of a problem. Learn to think recursively, visualise the …
- Meaningful Names
… Learn simple rules for naming variables, functions and classes so code explains itself. The big idea A name …
- What Is Clean Code?
… Which one would you rather debug at 2 a.m.? ❌ Hard to read js function calc(a, b …
- Trees & Binary Search Trees
… node.right; } return null; } function insert(node, value) { if (!node) return new TreeNode(value); if (value < node.value …
- Stacks & Queues
… When a function returns, its frame is popped. js function a() { b(); } function b() { c(); } function c() { console …
- O — Open/Closed Principle
… the growing if/else js // ❌ Every new payment method = edit this function again function processPayment(order, method) { if …
- Go Fundamentals
… Maps are also not safe for concurrent writes (see the concurrency lesson). Functions A function can return several …
- React Fundamentals
… When state changes, React re-renders that component (and its children). jsx import { useState } from "react"; function Counter …
- Async JavaScript: Promises, async/await and Node's Event Loop
… looks like normal code, same promises underneath async function loadOrders(id) { const user = await readUser(id); return readOrders …
- Big-O Notation Made Simple
… same work no matter how big the array is function first(arr) { return arr[0]; } // O(n): one …
- Clean Error Handling
… Fail fast with guard clauses Check bad input at the top of the function and exit immediately. This …
- Linked Lists
… Traverse js function toArray(head) { const values = []; for (let node = head; node !== null; node = node.next) values.push …
- I — Interface Segregation Principle
… string) { / … / } } // Functions ask only for what they need function printReport(printer: Printer, report: Document) { printer.print(report); // accepts …
- KISS: Keep It Simple, Stupid
… Simplify conditions js // ❌ function getShippingCost(country) { if (country === "US") { return 5; } else if (country === "CA") { return 8; } else …
- Polymorphism
… number) {} area() { return 0.5 this.base this.height; } } // This function works with ANY shape, now and in …
- Behavioral Patterns I: Observer, Strategy, Command, State
… 0] S -- D[by weight] In JavaScript, a strategy is usually just a function . You use it every …
- SOLID at a Glance
… TypeScript adds real interfaces. - Functions are first-class, so you can often pass a function where Java would …
- Sorting Algorithms
… After each pass, the largest remaining item has floated to the end. js function bubbleSort(arr) { for (let …
- S — Single Responsibility Principle
… jsx // ❌ Fetching + state + formatting + rendering in one component function UserProfile({ id }) { const [user, setUser] = useState(null); useEffect(() = { fetch …
- Binary Search
… record it and keep searching left . js function firstIndexOf(sorted, target) { let lo = 0, hi = sorted.length - 1 …
- Two Pointers & Sliding Window
… pair with target sum (sorted array) js function pairWithSum(sorted, target) { let left = 0; let right = sorted.length …
- Advanced TypeScript for Frontend
… Order }; function OrderPanel({ screen }: { screen: OrderScreen }) { switch (screen.status) { case "loading": return <Spinner / ; case "error": return <ErrorMessage message …
- Code Profiling
… A small function called a million times may be the real problem. What to measure Symptom Start by …
- D — Dependency Inversion Principle
… Mailer, ) {} } DIP with plain functions In JavaScript you don't need classes. A higher-order function works just …
- Graphs: BFS & DFS
… in an unweighted graph, it finds the shortest path (fewest edges). js function shortestPath(graph, start, goal) { const …
- Neural Networks and Deep Learning
… An activation function adds nonlinearity, allowing stacked layers to represent more than one linear transformation. The final layer …