Engineering Code Lab · JavaScript in your browser
Code that measures, filters and controls.
32 short programming problems pulled straight from engineering: average a sensor, debounce a button, find a root, tune a PID loop, fit a calibration line. Each has starter code, automated tests (some hidden), hints that unlock one at a time, and an explanation once you solve it.
How the sandbox keeps you safe
- runs in your browserNever on a server.
- no networkThe sandbox cannot fetch, post or open sockets.
- 3 s limitInfinite loops are stopped, not frozen.
- nothing uploadedDrafts stay in this browser.
Level 3: Innovator
10 exercises also come as a buggy version to fix: guided debugging, the way real engineering often starts.
Levels describe what you can already do, not your age.
- ○ L3 · Signal processingMoving-average filterSmooth a noisy signal by averaging a window that slides along it, then plot both.sliding windows🐞 debug variantplots
- ○ L3 · Signal processingMedian filter for glitchesRemove one-sample glitches from a distance sensor with a three-point median.sorting small arraysplots
- ○ L3 · Control systemsTraffic-light state machineModel a traffic light as states, transitions and timers, with a safe default.state machines🐞 debug variant
- ○ L3 · ManufacturingSort parts by weightOrder a parts list by mass and count how many comparisons insertion sort makes; watch it step by step.sorting and counting comparisonsvisualiser
- ○ L3 · ElectronicsBinary search a resistor seriesFind a value in the sorted E12 resistor series by halving the search range, and count the probes.binary searchvisualiser
- ○ L3 · SensorsThermistor lookup tableRead between the rows of a datasheet table with linear interpolation and clamp outside it.linear interpolationplots
- ○ L3 · PowerCoulomb countingTrack a battery's state of charge by integrating current over time, clamped to 0–100 %.accumulating over timeplots
How it works
- Write in the editor: Tab indents, Ctrl/⌘ + Enter runs.
- Run to see
console.logoutput, line charts fromplot(xs, ys, "label"), or a step-by-step sorting and searching visualiser. - Check to run the visible and hidden tests. Hidden tests show pass or fail, never the expected answer.
- Stuck? Hints unlock one at a time. Nothing is timed and nothing is ranked.