Talk Is Cheap, Show Me The Code
Codekilla
CODEKILLA
// examples.javascript()

JavaScript examples.

Bring websites to life.

JavaScript402 programs runnable inline41 chapters
Chapter 01 of 41·10 programs

JS Basics

console.log, let/const/var, template literals, semicolons, comments, typeof

Chapter 02 of 41·2 programs

JavaScript — Starter Programs

Minimal runnable programs to get you started with JavaScript. Admins can add more via the admin panel or the AI bulk-generate button.

Chapter 03 of 41·10 programs

Operators & Math

arithmetic, comparison, logical, ternary, nullish coalescing, optional chaining, spread/rest

Chapter 04 of 41·10 programs

Strings

indexing, slice, template literals, length, split/join, replace/replaceAll, regex basics

Chapter 05 of 41·10 programs

Arrays

literal, push/pop/shift/unshift, map/filter/reduce, find/some/every, sort with compare fn, destructuring

Chapter 06 of 41·10 programs

Objects

literal, dot vs bracket, Object.keys/values/entries, destructuring, spread, computed keys

Chapter 07 of 41·10 programs

Control Flow

if/else, switch, for, while, for...of, for...in, break/continue, labeled loops

Chapter 08 of 41·10 programs

Functions

declarations vs expressions, arrow funcs, default params, rest params, IIFE, closures, this binding

Chapter 09 of 41·10 programs

ES6+ Classes & Modules

class, constructor, methods, static, get/set, extends, super, import/export

Chapter 10 of 41·10 programs

Async / Promises

callbacks, Promise (resolve/reject/then/catch), async/await, Promise.all/allSettled, fetch demo

Chapter 11 of 41·10 programs

Mini Projects

FizzBuzz, palindrome check, Caesar cipher, debounce/throttle, click-counter, simple stopwatch, fetch + render JSON, form validator, light dark toggle, tiny router

Chapter 12 of 41·10 programs

Array Methods In Depth

map, filter, reduce, find/findIndex, some/every, flat/flatMap, sort with comparator, splice vs slice, fill, chaining pipelines

Chapter 13 of 41·10 programs

String Mastery

template literals, padStart/padEnd, split/join tricks, replaceAll with regex, case conversions, trim variants, char codes, localeCompare, repeat patterns, string reversal

Chapter 14 of 41·10 programs

Objects & Destructuring

nested destructuring, default values, rest/spread, computed keys, Object.entries/fromEntries, shallow vs deep clone, freeze/seal, property descriptors, optional chaining, nullish coalescing

Chapter 15 of 41·10 programs

Maps & Sets

Map basics, Map vs object, iterating maps, Set dedupe, set algebra, WeakMap use case, counting with Map, grouping with Map, LRU sketch, two-sum with Map

Chapter 16 of 41·10 programs

Dates & Times

Date basics, formatting with Intl, date math, countdown timer logic, age calculator, weekday names, ISO parsing, timezones with Intl, stopwatch with Date.now, relative time

Chapter 17 of 41·10 programs

Math & Numbers

rounding methods, random ranges, prime check, fibonacci, factorial, number formatting Intl, parseInt/parseFloat gotchas, toFixed pitfalls, BigInt, base conversions

Chapter 18 of 41·10 programs

Regular Expressions

test vs match, matchAll groups, named groups, replace with function, split with regex, validation email/phone, greedy vs lazy, flags, lookahead basics, sanitizing input

Chapter 19 of 41·10 programs

Closures & Scope

lexical scope, closure counters, module pattern, once function, memoize, private state, loop closure gotcha, currying, partial application, IIFE

Chapter 20 of 41·10 programs

Higher-Order Functions

functions as arguments, returning functions, compose, pipe, debounce, throttle, custom map implementation, custom filter, tap/logging, function factories

Chapter 21 of 41·10 programs

This & Binding

this in methods, arrow vs regular, call/apply/bind, losing this, constructor this, class field arrows, explicit binding patterns, borrowed methods, safe callbacks, bound counters

Chapter 22 of 41·10 programs

Prototypes & Classes

prototype chain, Object.create, constructor functions, class getters/setters, static members, inheritance with extends, super calls, instanceof, mixins, polymorphism demo

Chapter 23 of 41·10 programs

Error Handling

try/catch/finally, throw custom errors, Error subclasses, error cause, guarding JSON.parse, async errors, retry helper, validation errors, defensive defaults, safe wrappers

Chapter 24 of 41·10 programs

Async Deep Dive

promise chaining, Promise.all, allSettled, race/any, sequential vs parallel, timeout wrapper, cancellation flag, async queue, microtask demo, async error propagation

Chapter 25 of 41·10 programs

Generators & Iterators

iterator protocol, custom iterable, generator basics, infinite sequences, take helper, generator delegation, id generator, pagination iterator, lazy mapping, simple state machine

Chapter 26 of 41·10 programs

JSON & Data Transformation

parse/stringify options, reviver/replacer, deep clone via structuredClone, flatten nested JSON, groupBy, normalize array to map, pivot records, diff two objects, safe getters, CSV string to objects

Chapter 27 of 41·10 programs

Recursion

factorial, fibonacci memo, sum nested arrays, deep object search, tree traversal, permutations, flood-fill on grid, binary search recursive, nested menu depth, tower of hanoi

Chapter 28 of 41·10 programs

Sorting & Searching

custom comparators, multi-key sort, stable sort demo, binary search, quicksort, merge sort, counting occurrences, top-N selection, search in rotated array, fuzzy includes

Chapter 29 of 41·10 programs

Data Structures

stack, queue, linked list, binary tree insert/search, BFS, DFS, hash-map collisions concept, min-heap, graph adjacency list, trie sketch

Chapter 30 of 41·10 programs

Algorithm Challenges

two sum, anagram groups, longest unique substring, array chunk, matrix transpose, spiral order, balanced brackets, roman numerals, run-length encoding, move zeroes

Chapter 31 of 41·10 programs

Functional Patterns

immutability patterns, pure functions, reducers, maybe/optional pattern, result pattern, pipeline with reduce, point-free style, memo with WeakMap, freeze-based state, compose utilities

Chapter 32 of 41·10 programs

Timers & Scheduling

setTimeout basics, clearing timers, setInterval clock, debounce vs throttle, polling with backoff, task queue, batch scheduler, countdown, rate limiter, sleep helper

Chapter 33 of 41·10 programs

Events & Patterns

custom event emitter, once listeners, pub/sub, observer pattern, command pattern, state machine, undo stack, middleware chain, plugin registry, delegation logic

Chapter 34 of 41·10 programs

Modules & Organization

factory functions, dependency injection, singleton, config module, feature flags, constants enums, registry pattern, layered services, barrel pattern sketch, namespacing

Chapter 35 of 41·10 programs

Typed Thinking

runtime type checks, typeof/instanceof guards, schema validation by hand, assert helpers, exhaustive switch, safe parsing, defaults & coercion, invariant checks, duck typing, branded values sketch

Chapter 36 of 41·10 programs

Storage & URL Logic

localStorage wrapper, sessionStorage cart, URLSearchParams, URL parsing, query-string builder, cookie string parsing, history state sketch, base64 encode/decode, JSON storage versioning, expiring cach

Chapter 37 of 41·10 programs

Text & Formatting

Intl number/currency, plural rules, relative time formatter, slugify, truncate with ellipsis, word wrap, highlight matches, template renderer, simple markdown bold parser, word diff

Chapter 38 of 41·10 programs

Performance Patterns

memoization, lazy initialization, batching updates, early exit loops, Set membership vs includes, key lookup vs find, string builder pattern, avoiding re-computation, measuring with performance.now, o

Chapter 39 of 41·10 programs

Practical Utilities

deep get/set by path, uuid v4 generator, random picker, shuffle, range helper, clamp/lerp, retry with backoff, chunk processor, deep equal, debounce with leading edge

Chapter 40 of 41·10 programs

Capstone Challenges

expense tracker logic, quiz engine, shopping cart with discounts, bank ledger, inventory manager, flashcard scheduler, tic-tac-toe with winner check, URL shortener logic, mini state store, event-drive

Chapter 41 of 41·10 programs

Interview Warmups

reverse words in place, first non-repeating char, majority element, missing number, merge intervals, valid parentheses paths, product except self, max subarray, rotate matrix, staircase combinations