JavaScript
JavaScript fundamentals cheat sheet with ES6+ syntax, destructuring, modules, closures, scope, and modern best practices with examples.
Other JavaScript Sheets
Variables & Data Types
Understanding variables and primitive types
Variable Declaration
Different ways to declare variables
Primitive Data Types
JavaScript primitive types
Type Checking & Conversion
Checking and converting between types
Operators
All JavaScript operators
Arithmetic & Assignment
Math and assignment operators
Comparison & Logical
Comparing values and logical operations
Ternary & Special Operators
Conditional and other special operators
Control Flow
Controlling program execution
Conditional Statements
if, else, switch statements
Loops
for, while, do-while, for...of, for...in, break, and continue
Functions
Function declarations, expressions, and arrow functions
Function Declarations, Expressions & Arrows
Three ways to define functions — declarations, expressions, and arrow functions
Parameters & Arguments
Function parameters, defaults, rest, spread
Scope & Closures
Understanding scope and closure behavior
Hoisting & Strict Mode
JavaScript hoisting behavior and strict mode
Hoisting
Variable and function hoisting behavior
Strict Mode
Using strict mode for safer JavaScript
Objects & Arrays
Working with objects and arrays
Object Basics
Creating and manipulating objects
Map & Set
Key-value collections and unique value sets beyond plain objects and arrays
Array Basics
Creating and manipulating arrays
JSON
Parse and serialize data with JSON.parse() and JSON.stringify()
The "this" Keyword
Understanding this binding in different contexts
this Binding Rules
How this is determined in different contexts
Explicit this Binding
Using call, apply, and bind
Prototypes & Inheritance
JavaScript prototypal inheritance
Prototype Basics
Understanding the prototype chain
Prototypal Inheritance
Implementing inheritance with prototypes
Classes
ES6 class syntax and inheritance
Class Basics
Creating and using classes
Class Inheritance
Extending classes with inheritance
Error Handling
Handling errors and exceptions
Try/Catch/Finally
Handling exceptions with try/catch
Throwing Errors
Creating and throwing custom errors
Error Types
Common JavaScript error types
Modern JavaScript (ES6+)
Modern JavaScript features
Spread & Rest Operators (...)
Expand iterables and collect remaining elements with the ... syntax
Template Literals
String templates and tagged templates
Destructuring
Extracting values from arrays and objects
Modules
ES6 module system
Optional Chaining & Nullish Coalescing
Safe property access and default values