coderef

JavaScript Quick Reference

Modern JavaScript: variables, strings, arrays, objects, functions, async/await, classes, modules and the DOM.

10 sections · 85 snippets · updated Oct 14, 2026

Click any snippet to copy it.

Basics

Variables, output and types.

Numbers & conversion

Math and converting values.

Strings

Working with text.

Arrays

Creating, changing and transforming arrays.

Objects

Key–value data.

Control flow

Conditions and loops.

Functions

Declaring and calling functions.

Async

Promises, async/await and fetch.

  • Async function
    Try it Yourself »
  • Handle errors
    Try it Yourself »
  • Run in parallel
    Try it Yourself »
  • POST JSON
    Try it Yourself »
  • Wait (sleep)
    Try it Yourself »
  • Promise chain
    Try it Yourself »

Classes & modules

Classes and ES modules.

DOM

Working with the page in the browser.

← All quick references