tryjs.app
Runnable JavaScript and TypeScript examples
Start from working JavaScript, async, and TypeScript examples, then open them in the TryJS playground to edit, run, share, or extend.
JS Fundamentals
Map, Filter, Reduce
Transform, filter, and aggregate arrays
javascriptDestructuring
Object and array destructuring patterns
javascriptSpread & Rest
Spread operator and rest parameters
javascriptClosures
Functions that capture their scope
javascriptMap & Set
Built-in collection types
javascriptOptional Chaining
Safely access nested properties with ?.
javascriptNullish Coalescing
Default values with ?? — safer than ||
javascriptDebounce vs Throttle
Rate-limiting functions — two common strategies
javascriptDeep Clone
structuredClone vs JSON vs manual
javascriptThe 'this' Keyword
How 'this' is determined at call time
javascriptHoisting
var, let, const, and function declarations
javascriptfor...of vs for...in
Choosing the right iteration syntax
javascriptMemoization
Cache function results for speed
javascriptAsync Patterns
Promise.all
Run async operations in parallel
javascriptAsync/Await Error Handling
Try/catch with async functions
javascriptPromise.race & allSettled
Advanced Promise combinators
javascriptEvent Loop Demo
Microtasks vs macrotasks — execution order explained
javascriptAsync Iterators
for await...of and async generators
javascript