JavaScript
Learn JavaScript by typing real, idiomatic code.
Type your way through the JavaScript you actually write: closures, destructuring, async/await, and the array methods (map, filter, reduce) that shape everyday code. Each snippet is real, idiomatic JavaScript, and an AI tutor explains every line — why a promise resolves the way it does, when to reach for a spread — while you build the muscle memory to type it fast.
Progress0 / 705 solved · 0/50 sections
best wpm
0
avg wpm
0
accuracy
0%
runs
0
level
1
rating
1000
Run JavaScript on your machine
1. Install the toolchain
brew install node # or: sudo apt install nodejs2. Save your code as hello.js, then compile & run
node hello.jsprogress by section
1Fundamentals0/12start →
2Strings In Depth0/18start →
3Values & References0/18start →
Primitives copy by valueArrays share a referenceconst binds, not contentsReference identityShallow copy an objectObjects share a referencePrimitive arguments are safeShallow copy with spreadCompare by contents=== vs Object.isObject.freezeFunctions mutate objectsRebinding is localReturn new vs mutateDeep copyfill shares one referenceObject identity as a keyShallow copies share nesting
4Slices & Arrays0/18Unlock →
5Data structures0/9Unlock →
6Iterators0/20Unlock →
sum / product / countentriesfiltermapslice (take & skip)spread & concatfilter + mapArray.from & spreadmin & max by keypartitionreduce (fold)reduce without a seedsome / every / find / findIndextakeWhile / dropWhilezip two arraysflat & flatMapA generator functionrunning totals (scan)An infinite generatorA custom iterable
7Traits0/20Unlock →
Accept anything string-likeConversion via static factoryDefaults via spreadDuck typingNegateCopy vs shared referenceComparator and sortCustom equalityComposite Map keysScale by a scalarCustom toStringBuild from an iterableIterable via generatorMixins with Object.assignFallible conversionvalueOf for +Custom instanceofCustom iteratorSymbol.toPrimitiveIndexing via Proxy
8Generics0/20Unlock →
Generic by duck typingReturn any two typesSwap any twoDuck typing a methodA tagged value holderJSDoc @templateA generic transformA container classDeep clone any valueA container with mapA default valueGeneric over iterablesGeneric minA non-empty listA generic QueueA generic StackA generic composeA documented generic functionmax by keyFixed-size typed arrays
9Lifetimes0/20Unlock →
Block scopeA closure captures a variableA closure reading outer dataA function referenceReturn an internal fieldA program-long valueA substring viewTwo captured valuesReturn an array elementClosure keeps state aliveReturn a capturing closureA tagged unionA value wrapperLongest via reduceThe loop-variable gotchaA closure mutating outer stateA generator over an arrayWeakMap for private dataFinalizationRegistryWeakRef does not retain
10Closures0/20Unlock →
An arrow functionCapturing the environmentMultiple parametersbindCallbacksCapturing in a filterFunction as an argumentClosures drive iteratorssort with a comparatorAn array of closuresA stateful closureCurryingIIFE for private stateReturn different functionsoncePartial applicationReturning a functioncomposememoizepipe
11Pattern Matching0/20Unlock →
switch on literalsArray defaultsDestructure an arrayDestructure an objectRange checks with ifswitch returning a valueSwap with destructuringGrouped casesChained ternaryArray rest patternDiscriminated unionGuards with ifRename and defaultObject rest patternOptional chainingDestructure in parametersA result tagMatch an array by shapeNested destructuringRecursive tree sum
12Error Handling0/20Unlock →
Error.messagetry / catchfinally for cleanupthrow an errorContext in the messageCustom Error subclassfinally with returnBuilt-in error namesOptional catch bindingasync / await try / catcherror.causeError with propertiesError hierarchyBranch with instanceofAwaiting a rejectionLog then rethrowConstruct an AggregateErrorWalk the cause chainWrap a low-level errorAggregateError from Promise.any
13Option & Result0/20Unlock →
Absence is undefinedDefault parametersnull vs undefinedNullish coalescing ??Optional chaining ?.Drop the missing valuesArray.find returns undefinedfindIndex returns -1Map.get returns undefinedNullish assignment ??=?? versus ||Deep optional chainingTransform or defaultDefaults while destructuringGuard clause with == nullMap.has vs getOptional call ?.()Optional index ?.[]try / catch as a ResultThe [error, value] tuple
14Conversions0/15Unlock →
15Collection Conversions0/18Unlock →
16Math0/14Unlock →
17Encoding0/22Unlock →
Percent-encode for URLsString to bytesASCII checks and caseBase64 with btoa/atobBytes to stringChar to code pointDigit value in a baseHex with BufferBinary, octal, hexBase64 with BufferBig-endian bytesList code pointsHex encodeLittle-endian bytesUnits, bytes, code pointsParse a number in a baseLossy UTF-8 decodeCaesar cipherHex decodeROT13XOR cipherBase64 by hand
18Random0/20Unlock →
Math.random basicsCoin flipFloat in a rangeInteger in a rangePick an elementSeed from the clockWeighted true/falseCryptographic bytesRandom UUIDRandom enum valuePassword generatorRandom alphanumeric stringRoll many diceSeeded LCGReproducible sequencesSample k without replacementFisher-Yates shuffleWeighted choiceUnbiased secure integerNormal distribution
19Data I/O0/18Unlock →
Parse CSV into rowsJSON stringify and parseTab-separated valuesBuild a CSV stringSelect one columnCSV into a number matrixSplit off the headerWhitespace-separated matrixRead a data fileSkip blanks and commentsPrint an aligned tableWrite a matrix as textAppend a rowkey=value config to a Mapkey=value config to objectStream lines with readlineRound-trip write then readDrop unparseable rows
20Linear Algebra0/21Unlock →
Matrix shapeFlatten a matrixScalar multiplyA matrix of zerosElementwise addArgmax of a vectorIdentity matrixOne-hot encodeTraceStack rows (vstack)ReLU and sigmoidApply a function elementwiseColumn meansColumn sumsCosine similarityMatrix times vectorTransposeMatrix multiplyMin-max normalize columnsSoftmaxStandardize columns (z-score)
21Text Processing0/16Unlock →
22Date & Time0/12Unlock →
23Memory0/12Unlock →
24Modules0/20Unlock →
Default importNamed importsImport with an aliasimport.meta.urlNamespace importChoose a module at runtimeDefault exportDynamic import()Export a classExport a group of namesRename on exportInspect built-in modulesimport.meta.dirnameNamed exportsSide-effect importTop-level awaitImport JSON with attributesNamespace re-exportRe-export from another modulecreateRequire in an ES module
25Macros0/21Unlock →
console.assert and a custom assertArray construction like vec!Computed property namesA dbg helperDynamic property accessA matches helperString.rawFormatting like format!Getters and settersTurn code into a stringSymbols as unique keysTagged template literalsObject.definePropertyGenerators as code generatorsReflectA tiny DSL with a tagDecorators, as runtime wrappersThe Function constructorA Proxy with defaultsA Proxy get trapA custom iterable
26Testing0/20Unlock →
assert.strictEqualassert with a messageassert.notStrictEqualnode:test basicsTesting string outputCovering both branchesAsserting on an arrayassert.deepStrictEqualdescribe and itassert.doesNotThrowA test helper functionbeforeEach setupSkipping a testassert.throwsAn async testA tiny expect helperComparing floatsMatching an error messageassert.rejectsTable-driven tests
27Algorithms0/8Unlock →
28Sorting Algorithms0/12Unlock →
29Expression Parsing0/6Unlock →
30Idioms0/9Unlock →
31OOP & Traits0/8Unlock →
32Trait Objects0/14Unlock →
Array sharing a methodAccept anything with the methodReturn one of several typesArray of functionsClosure carrying dataObject with two rolesRecover the concrete typeRuntime type checkShared default behaviorShared object referenceSum over mixed objectsLazy vs eager sequenceHandler registrySymbol-based protocol
33Design Patterns0/14Unlock →
34Async0/11Unlock →
35File I/O0/6Unlock →
36Filesystem0/18Unlock →
Does a path exist?Copy a fileBuild a pathCreate nested directoriesList a directoryRename or moveChange the extensionFiles vs directoriesFile metadataPath componentsRemove files and treesSorted listingWrite to the temp dirFilter by extensionLast modified timeResolve to a real pathTotal size of a treeWalk the tree
37Networking0/16Unlock →
Parse a URLSplit host and portStatus codesParse a request lineRoute by pathURLSearchParamsBuild a raw HTTP responseBind an ephemeral portRead request headersCancel a request with AbortControllerServe and consume JSONAn HTTP server on an ephemeral portPOST a request bodyA TCP echo server and clientRead newline-delimited dataA UDP datagram exchange
38Concurrency0/15Unlock →
async and awaitPromise.allSleeping without blockingPromise.allSettledPromise.anyPromise.raceMicrotasks vs timersConcurrent vs sequentialAn async task queueA short-lived worker threadAtomics operationsA mutex from a promise chainA concurrency limiterPassing data to a workerAtomics on a SharedArrayBuffer
39Unsafe & FFI0/14Unlock →
40Commands0/14Unlock →
41Array0/10Unlock →
43String0/10Unlock →
45Interval0/5Unlock →
46Linked List0/6Unlock →
47Tree0/14Unlock →
Maximum Depth of Binary TreeInvert Binary TreeSame TreeLowest Common Ancestor of a BSTBinary Tree Level Order TraversalSubtree of Another TreeKth Smallest Element in a BSTImplement Trie (Prefix Tree)Validate Binary Search TreeAdd and Search WordConstruct Binary Tree from Preorder and InorderBinary Tree Maximum Path SumSerialize and Deserialize Binary TreeWord Search II