Cheatsheets

JavaScript Cheatsheet

Use this JavaScript cheatsheet for modern syntax reminders: variables, arrays, objects, functions, modules and async code.

Quick reference

Variables and functions

Constantconst name = "DevKitYard";
Mutablelet count = 0;
Arrow functionconst add = (a, b) => a + b;
Default valuefunction greet(name = "there") {}

Arrays and objects

Mapitems.map((item) => item.name)
Filteritems.filter((item) => item.active)
Spread array[...items, nextItem]
Spread object{ ...user, active: true }

Async

Promisefetch(url).then((res) => res.json())
Async/awaitconst data = await fetch(url)
Try/catchtry { ... } catch (error) { ... }
Module exportexport function helper() {}

Modules and errors

Named exportexport function format() {}
Named importimport { format } from './format.js'
Throwthrow new Error('Invalid value')
Catch unknowncatch (error) { … }

Iteration and collections

Mapitems.map(item => item.name)
Filteritems.filter(item => item.active)
Finditems.find(item => item.id === id)
Setnew Set(values)

Examples

CodeFetch JSON safely
async function loadData(url) {
  const response = await fetch(url);
  if (!response.ok) throw new Error("Request failed");
  return response.json();
}
CodeAbort a fetch
const controller = new AbortController();
const response = await fetch(url, { signal: controller.signal });
controller.abort();

JavaScript FAQ

What is included in the JavaScript cheatsheet?

JavaScript Cheatsheet includes quick reference sections, practical examples, common mistakes, tips and links to related DevKitYard tools.

Is the JavaScript cheatsheet interactive?

This cheatsheet is a static quick reference focused on concise commands, syntax and examples.

When should I use this JavaScript reference?

Use it when you need to recall syntax, compare common patterns or avoid mistakes without opening a long tutorial.

What should I use after reading this cheatsheet?

Use related DevKitYard tools such as JSON Formatter & Validator, Timestamp Converter when you need to format, validate, generate or inspect real output.