es6-cheatsheet
ES2015 [ES6] cheatsheet containing tips, tricks, best practices and code snippets
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.
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.
Where it fits
- Look up the correct ES6 syntax for a specific feature like destructuring or arrow functions when you can't remember how it works.
- Learn the difference between let, const, and var and understand block scope when writing modern JavaScript.
- Find a quick before-and-after comparison to understand how Promises, async/await, or ES6 modules replace older patterns.