Skip to content

Modern JavaScript Cheatsheet

Modern JavaScript cheatsheet

Widely inspired from meaudru Modern JavaScript Cheatsheet with some alterations.

Introduction

Motivation

This document is a cheatsheet for JavaScript you will frequently encounter in modern projects and most contemporary sample code.

This guide is not intended to teach you JavaScript from the ground up, but to help developers with basic knowledge who may struggle to get familiar with modern codebases (or let's say to learn React for instance) because of the JavaScript concepts used.

Besides, I will sometimes provide personal tips that may be debatable but will take care to mention that it's a personal recommendation when I do so.

Note: Most of the concepts introduced here are coming from a JavaScript language update (ES2015, often called ES6). You can find new features added by this update here; it's very well done.

Table of Contents

Complementary Resources

When you struggle to understand a notion, I suggest you look for answers on the following resources:

Glossary

Scope

The context in which values and expressions are "visible," or can be referenced. If a variable or other expression is not "in the current scope," then it is unavailable for use.

Source: MDN

Variable mutation

A variable is said to have been mutated when its initial value has changed afterward.

var myArray = [];
myArray.push("firstEl") // myArray is being mutated

A variable is said to be immutable if it can't be mutated.

Check MDN Mutable article for more details.