explaingit

drksephy/es6-cheatsheet

13,336JavaScriptAudience · developerComplexity · 1/5Setup · easy

TLDR

A plain-text reference guide covering the new features added to JavaScript in ES6 (2015), with before-and-after code examples showing old-style JavaScript alongside the modern equivalent for each topic.

Mindmap

mindmap
  root((ES6 Cheatsheet))
    Variables
      let and const
      Block scope
    Functions
      Arrow functions
      Default params
      Rest params
    Syntax
      Destructuring
      Template literals
      Classes
    Async
      Promises
      Generators
      Async await
    Modules
      Import export
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Look up the correct ES6 syntax for a specific feature like destructuring or arrow functions when you can't remember how it works.

USE CASE 2

Learn the difference between let, const, and var and understand block scope when writing modern JavaScript.

USE CASE 3

Find a quick before-and-after comparison to understand how Promises, async/await, or ES6 modules replace older patterns.

Tech stack

JavaScriptMarkdown

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

This repository is a cheatsheet for ES6, also called ES2015, which is a major update to the JavaScript programming language that introduced many new features and syntax improvements. The cheatsheet is written in plain Markdown, contains no runnable application, and is meant to be read rather than installed or run. The content covers a wide range of features added in that JavaScript update. Each section explains a concept, shows the old way of doing something alongside the new way, and notes best practices. Topics include: two new variable declaration keywords (let and const) and how they differ from the older var in terms of scope, shorter function syntax using arrow functions, template literals for embedding values inside strings without concatenation, destructuring for pulling values out of arrays and objects in fewer lines, and default and rest parameters for function arguments. The cheatsheet also covers modules, which are the system JavaScript now uses for splitting code into separate files and importing what you need. There are sections on classes (a cleaner syntax for object-oriented code), Symbols (a rarely-used primitive type), Maps and WeakMaps (key-value structures that accept any type as a key), Promises (for managing asynchronous operations), Generators (functions that can pause and resume), and async/await syntax (a cleaner way to write asynchronous code built on top of Promises). Getter and setter functions round out the topics covered. For each feature, the README shows a before-and-after comparison: old-style JavaScript on one side, the ES6 equivalent on the other. This pattern makes the cheatsheet useful as a quick lookup for developers who know JavaScript but are learning or transitioning to more modern syntax. There is no installation step and no dependencies. The content lives entirely in the README file. Contributions from the community are welcome per the repository notes.

Copy-paste prompts

Prompt 1
Using ES6 syntax from the cheatsheet, rewrite this JavaScript function to use arrow functions, destructuring, and template literals instead of older syntax.
Prompt 2
Show me how ES6 default parameters, rest parameters, and the spread operator work together in a practical function example.
Prompt 3
Based on the ES6 cheatsheet, convert this callback-based async code to use Promises, then rewrite it again using async/await.
Prompt 4
Give me examples of when to use an ES6 Map instead of a plain object, and show how WeakMap differs from Map.
Open on GitHub → Explain another repo

← drksephy on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.