Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.
Scope and conventions
TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.
JSON.stringify encodes supported JavaScript values. It can throw for cycles/BigInt and omits or transforms some values; do not assume arbitrary object identity survives a round trip.
Fragment
Use a schema/encoding policy for dates, BigInt and other domain types.
trim returns text without edge whitespace. split returns an array; map transforms each item. slice takes an end-exclusive range. length and slice use UTF-16 code units.
Fragment
Independent fragments.
main.ts
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const fields = "2 5".split(" ").map(Number);const word = "north".slice(0, 2);const clean = " west ".trim();
Single and double quotes create strings; there is no separate char primitive. Backticks allow interpolation and literal newlines. Escape sequences such as \n represent a character rather than two visible letters.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
string.length counts UTF-16 code units. String iteration visits Unicode code points, not grapheme clusters. A visible character can contain multiple code points, so neither count is universally a user-perceived character count.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
main.ts
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const text = "🦀";const units = text.length; // 2const points = [...text].length; // 1
JavaScript string values are immutable. Concatenation/replacement returns another string; assigning it updates the binding. replace with a plain string replaces only the first match; replaceAll replaces all matches.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
main.ts
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
let text = "north";text += " gate";const changed = text.replace("north", "west");