Data structures

Array&List

Array
Dynamic array
Linked list
Double linked list
Stack
Queue

Graph&Tree

Graph
Tree
Trie (digital/prefix tree)
an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings
BST (binary search tree)
left child of a node has value less than the parent and right child has value greater than parent
AVL (Adelson-Velsky and Landis)
self-balancing binary search tree
binary search tree with additional property that difference between height of left sub-tree of any node can't be more than 1

named after inventors Adelson-Velsky and Landis

B-tree
2–3–4 tree
Red–black tree

Set&Map

Set
Map
Hash Map

Matrix

Algorithms

Search algorithms

Linear / Sequential search
Binary / Half-interval / Logarithmic / Binary chop search
Jump search
Interpolation search
Exponential /Doubling / Galloping / Struzik search
Fibonacci search

Sort algorithms

Simple sort (n2)

Insertion sort
Selection sort

Bubble sort and variants (n2)

Bubble sort
Comb sort
Shell sort
in-place comparison sort, can be seen as either a generalization of sorting by exchange (bubble sort) or sorting by insertion (insertion sort)

Efficiant sort (n log n)

Merge sort
Heap sort
Quick sort

Distribution sort

Counting sort (n+r)
Bucket sort (n+k)
Radix sort

Graph&Tree traversal

BFS (Breadth-first search)
finding the shortest path (queue)
DFS (Depth-first search)
edge based technique (stack)

BFS & DFS Worst-case performance: O(V+E), V - verices, E - edges

SDLC

Software development life cycle

SDLC stages

Planning and Requirement Analysis
Defining Requirements
Designing the Product Architecture
Building or Developing the Product
Testing the Product
Deployment in the Market and Maintenance

SDLC methodologies

Waterfall Model
V-Shaped Model
Iterative Model
Spiral Model
Big Bang Model
Agile Model

Anti-Patterns

Organizational

Analysis paralysis
A project stalled in the analysis phase, unable to achieve support for any of the potential plans of approach
Bicycle shed
Giving disproportionate weight to trivial issues
Bleeding edge
Operating with cutting-edge technologies that are still untested or unstable leading to cost overruns, under-performance or delayed delivery
Bystander apathy
The phenomenon in which people are less likely to or do not offer help to a person in need when others are present
Cash cow
A profitable legacy product that often leads to complacency about new products
Design by committee
The result of having many contributors to a design, but no unifying vision
Escalation of commitment
Failing to revoke a decision when it proves wrong
Groupthink
A collective state where group members begin to (often unknowingly) think alike and reject differing viewpoints
Management by objectives
Management by numbers, focus exclusively on quantitative management criteria, when these are non-essential or cost too much to acquire
Micromanagement
Ineffectiveness from excessive observation, supervision, or other hands-on involvement from management
Moral hazard
Insulating a decision-maker from the consequences of their decision
Mushroom management
Keeping employees "in the dark and fed manure" (also "left to stew and finally canned")
Peter principle
Continually promoting otherwise well-performing employees up to their level of incompetence, where they remain indefinitely[4]
Seagull management
Management in which managers only interact with employees when a problem arises, when they "fly in, make a lot of noise, dump on everyone, do not solve the problem, then fly out"
Stovepipe or Silos
An organizational structure of isolated or semi-isolated teams, in which too many communications take place up and down the hierarchy, rather than directly with other teams across the organization
Typecasting
Locking successful employees into overly safe, narrowly defined, predictable roles based on their past successes rather than their potential
Vendor lock-in
Making a system excessively dependent on an externally supplied component

Project management

Cart before the horse
Focusing too many resources on a stage of a project out of its sequence
Death march
A project whose staff, while expecting it to fail, are compelled to continue, often with much overwork, by management which is in denial[5]
Ninety-ninety rule
Tendency to underestimate the amount of time to complete a project when it is "nearly done"
Overengineering
Spending resources making a project more robust and complex than is needed
Scope creep
Uncontrolled changes or continuous growth in a project's scope, or adding new features to the project after the original requirements have been drafted and accepted (also known as requirement creep and feature creep)
Smoke and mirrors
Demonstrating unimplemented functions as if they were already implemented
Brooks's law
Adding more resources to a project to increase velocity, when the project is already slowed down by coordination overhead.

Principles

SOLID

Single Responsibility Principle (SRP)
class should have single responsibility
class shoud have one, and only one, reason to change
Open/Closed Principle (OCP)
class should be open for extension, but closed for modification
Liskov substition principle (LSP)
object should be replacable by instances of their subtypes without altering the correctness of that programm
Interface Segregation Principle (ISP)
many client specific interfaces better then one general purpose interface
Dependency Inversion Principle (DIP)
one should depend upon asbtraction not conretion

GRASP

General responsibility assignment software patterns

Controller
Controller is responsible for receiving or handling a system event
Creator
Creator is responsible for creating objects
- contain or compositely aggregate instances
- record or closely use instances
- have initializing information for instances
High cohesion
Responsibility are strongly related and highly focused
Indirection
Assign the responsibility of mediation between two elements to an intermediate object
Information expert
Assign the responsibility to the class which has the information neccessary to fulfill that responsibility
Low coupling
Assign responsibilities to support lower dependency between classes, change in one class having lower impact on other classes, higher reuse potential
Polimorphism
Assign a responsibility according to the type of variation of behaviors by polymorphic operations
Protected variation
Protects elements from variations on others by wrapping into interface and using polymorphism
Pure fabrication
Specially made class to archieve low coupling, high cohesion and reuse potential

YARGNI

You aren't gone need it`

KISS

Keep it short and simple

DRY

Don't repeat your self

Hollywood Principle

Don’t Call Us, We’ll Call You.

Ocam's razor

Entities should not be multiplied without necessity. When presented with competing hypotheses that make the same predictions, one should select the solution with the fewest assumptions, and it is not meant to be a way of choosing between hypotheses that make different predictions

SSOT (single source of truth)

Single source of truth (SSOT) is the practice of structuring information models and associated data schema such that every data element is mastered (or edited) in only one place

Patterns

Creatinal patterns

Abstract factory
Builder
Factory method
Lazy initialization (virtual proxy)
Multiton
Object library
Object pool
Prototype
Resource acquisitino is initialization (RAII)
Singleton

Behaviral patterns

Blackboard
Chain of responsibility
Command
Interpreter
Interator
Mediator
Memento
Null object
Observer or Publish/Subscrube
Servant
Specification
State
Strategy
Template method
Visitor

Structural patterns

Adapter, Wrapper or Translator
Bridge
Composite
Decorator
Facade
Flyweight
Front controller
Marker
Module
Proxy
Twin

Concurency patterns

Active object
Balking
Binding properties
Double-checked locking
Event-based asynchrones
Guarded suspension
Join
Lock
Messaging desing pattern (MDP)
Monitor object
Reactor
Read-write lock
Scheduler
Thread pool
Thread specific storage

Anti-Patterns

Software design

Abstraction inversion
Not exposing implemented functionality required by callers of a function/method/constructor, so that the calling code awkwardly re-implements the same functionality in terms of those calls
Ambiguous viewpoint
Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint
Big ball of mud
A system with no recognizable structure
Database-as-IPC
Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable
Gold plating
Continuing to work on a task or project well past the point at which extra effort is not adding value
Inner-platform effect
A system so customizable as to become a poor replica of the software development platform
Input kludge
Failing to specify and implement the handling of possibly invalid input
Interface bloat
Making an interface so powerful that it is extremely difficult to implement
Magic pushbutton
A form with no dynamic validation or input assistance, such as dropdowns
Race hazard
Failing to see the consequences of events that can sometimes interfere with each other
Stovepipe system
A barely maintainable assemblage of ill-related components

Object-oriented programming

Anemic domain model
The use of the domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places). Martin Fowler considers this to be an anti-pattern, but some disagree that it is always an anti-pattern.[6]
Call super
Requiring subclasses to call a superclass's overridden method
Circle–ellipse problem
Subtyping variable-types on the basis of value-subtypes
Circular dependency
Introducing unnecessary direct or indirect mutual dependencies between objects or software modules
Constant interface
Using interfaces to define constants
God object
Concentrating too many functions in a single part of the design (class)
Object cesspool
Reusing objects whose state does not conform to the (possibly implicit) contract for re-use
Object orgy
Failing to properly encapsulate objects permitting unrestricted access to their internals
Poltergeists
Objects whose sole purpose is to pass information to another object
Sequential coupling
A class that requires its methods to be called in a particular order
Yo-yo problem
A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation

Programming

Accidental complexity
Programming tasks which could be eliminated with better tools (as opposed to essential complexity inherent in the problem being solved)
Action at a distance
Unexpected interaction between widely separated parts of a system
Boat anchor
Retaining a part of a system that no longer has any use
Busy waiting
Consuming CPU while waiting for something to happen, usually by repeated checking instead of messaging
Caching failure
Forgetting to clear a cache that holds a negative result (error) after the error condition has been corrected
Cargo cult programming
Using patterns and methods without understanding why
Coding by exception
Adding new code to handle each special case as it is recognized
Design pattern
The use of patterns has itself been called an anti-pattern, a sign that a system is not employing enough abstraction[7]
Error hiding
Catching an error message before it can be shown to the user and either showing nothing or showing a meaningless message. This anti-pattern is also named Diaper Pattern. Also can refer to erasing the Stack trace during exception handling, which can hamper debugging.
Hard code
Embedding assumptions about the environment of a system in its implementation
Lasagna code
Programs whose structure consists of too many layers of inheritance
Lava flow
Retaining undesirable (redundant or low-quality) code because removing it is too expensive or has unpredictable consequences[8][9]
Loop-switch sequence
Encoding a set of sequential steps using a switch within a loop statement
Magic numbers
Including unexplained numbers in algorithms
Magic strings
Implementing presumably unlikely input scenarios, such as comparisons with very specific strings, to mask functionality.
Repeating yourself
Writing code which contains repetitive patterns and substrings over again; avoid with once and only once (abstraction principle)
Shooting the messenger
Throwing exceptions from the scope of a plugin or subscriber in response to legitimate input, especially when this causes the outer scope to fail.
Shotgun surgery
Developer adds features to an application codebase which span a multiplicity of implementors or implementations in a single change
Soft code
Storing business logic in configuration files rather than source code[10]
Spaghetti code
Programs whose structure is barely comprehensible, especially because of misuse of code structures

Methodological

Copy and paste programming
Copying (and modifying) existing code rather than creating generic solutions
Every Fool Their Own Tool
Failing to use proper software development principles when creating tools to facilitate the software development process itself.[11][original research?]
Golden hammer
Assuming that a favorite solution is universally applicable (See Silver bullet)
Improbability factor
Assuming that it is improbable that a known error will occur
Invented here
The tendency towards dismissing any innovation or less than trivial solution originating from inside the organization, usually because of lack of confidence in the staff
Not Invented Here (NIH) syndrome
The tendency towards reinventing the wheel (failing to adopt an existing, adequate solution)
Premature optimization
Coding early-on for perceived efficiency, sacrificing good design, maintainability, and sometimes even real-world efficiency
Programming by permutation / accident / coincidence
Trying to approach a solution by successively modifying the code to see if it works
Reinventing the square wheel
Failing to adopt an existing solution and instead adopting a custom solution which performs much worse than the existing one
Silver bullet
Assuming that a favorite technical solution can solve a larger process or problem
Tester Driven Development
Software projects in which new requirements are specified in bug reports

DataBase

ACID

Atomicity
Transactions are often composed of multiple statements. Atomicity guarantees that each transaction is treated as a single "unit", which either succeeds completely, or fails completely: if any of the statements constituting a transaction fails to complete, the entire transaction fails and the database is left unchanged.
Consistency
Consistency ensures that a transaction can only bring the database from one valid state to another, maintaining database invariants: any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof.
Isolation
Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially. Isolation is the main goal of concurrency control; depending on the method used, the effects of an incomplete transaction might not even be visible to other transactions.
Durability
Durability guarantees that once a transaction has been committed, it will remain committed even in the case of a system failure.

CAP theorem

It is imposible for distributed data store to simultaneously provide more than two of the: Consistency, Availability, Partition tolerance

Consistency
all clients see the same data at the same time
Availability
the system continues to operate even in the presence of node failures
Partition tolerance
the system continues to operate inspite of network failure

Multiversion concurrency control (MCC or MVCC)
Without concurrency control, if someone is reading from a database at the same time as someone else is writing to it, it is possible that the reader will see a half-written or inconsistent piece of data. MVCC aims at solving the problem by keeping multiple copies of each data item. In this way, each user connected to the database sees a snapshot of the database at a particular instant in time. Any changes made by a writer will not be seen by other users of the database until the changes have been completed (or, in database terms: until the transaction has been committed.) When an MVCC database needs to update a piece of data, it will not overwrite the original data item with new data, but instead creates a newer version of the data item. Thus there are multiple versions stored. The version that each transaction sees depends on the isolation level implemented. The most common isolation level implemented with MVCC is snapshot isolation. With snapshot isolation, a transaction observes a state of the data as when the transaction started. MVCC introduces the challenge of how to remove versions that become obsolete and will never be read. In some cases, a process to periodically sweep through and delete the obsolete versions is implemented. This is often a stop-the-world process that traverses a whole table and rewrites it with the last version of each data item.

Isolation levels

read uncommitted
dirty read
read committed
non repeatable read
repeatable read
phantom read
serializable

Normal forms

UNF: Unnormalized form
1NF: First normal form
To satisfy 1NF, the values in each column of a table must be atomic.
2NF: Second normal form
To conform to 2NF and remove duplicities, every non-key attribute must depend on the whole key, not just part of it.
3NF: Third normal form
A table in third normal form (3NF) is a table in 2NF that has no transitive dependencies. No non-prime (non-key) attribute is transitively dependent on any key i.e. no non-prime attribute depends on other non-prime attributes. All the non-prime attributes must depend only on the keys.
EKNF: Elementary key normal form
The elementary key normal form (EKNF) falls strictly between 3NF and BCNF and is not much discussed in the literature. It is intended “to capture the salient qualities of both 3NF and BCNF” while avoiding the problems of both (namely, that 3NF is “too forgiving” and BCNF is “prone to computational complexity”).
BCNF: Boyce–Codd normal form
A relational schema R is considered to be in Boyce–Codd normal form (BCNF) if, for every one of its dependencies X → Y, one of the following conditions hold true:
- X → Y is a trivial functional dependency (i.e., Y is a subset of X)
- X is a superkey for schema R
4NF: Fourth normal form
Whereas the second, third, and Boyce–Codd normal forms are concerned with functional dependencies, 4NF is concerned with a more general type of dependency known as a multivalued dependency. A table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X ↠ {\displaystyle \twoheadrightarrow } \twoheadrightarrow Y, X is a superkey—that is, X is either a candidate key or a superset thereof.
ETNF: Essential tuple normal form
5NF: Fifth normal form
Fifth normal form (5NF), also known as project-join normal form (PJ/NF), is a level of database normalization designed to reduce redundancy in relational databases recording multi-valued facts by isolating semantically related multiple relationships. A table is said to be in the 5NF if and only if every non-trivial join dependency in that table is implied by the candidate keys. A join dependency *{A, B, … Z} on R is implied by the candidate key(s) of R if and only if each of A, B, …, Z is a superkey for R.[1]
DKNF: Domain-key normal form
Domain-key normal form (DK/NF) is a normal form used in database normalization which requires that the database contains no constraints other than domain constraints and key constraints. A domain constraint specifies the permissible values for a given attribute, while a key constraint specifies the attributes that uniquely identify a row in a given table. The domain/key normal form is achieved when every constraint on the relation is a logical consequence of the definition of keys and domains, and enforcing key and domain restraints and conditions causes all constraints to be met. Thus, it avoids all non-temporal anomalies.
6NF: Sixth normal form
A simple and intuitive definition of the sixth normal form is that "a table is in 6NF when the row contains the Primary Key, and at most one other attribute".

JavaScript

Bitwise Operators

&
AND statement
|
OR statement
~
NOT
^
XOR
<<
Left shift
>>
Right shift
>>>
Zero fill right shift

Object

Property descriptors

configurable
If false, the property cannot be deleted, cannot be changed to an accessor property, and attributes other than [[Value]] and [[Writable]] cannot be changed (false).
enumerable
If true, the property will be enumerated in for...in loops (false)
Data descriptor
value
The value retrieved by a get access of the property (undefined)
writable
If false, the property's value cannot be changed (false)
Accessor descriptor
get
The function is called with an empty argument list and retrieves the property value whenever a get access to the value is performed (undefined)
set
The function is called with an argument that contains the assigned value and is executed whenever a specified property is attempted to be changed (undefined)

Object

Object.assign()
Copies the values of all enumerable own properties from one or more source objects to a target object.
Object.create()
Creates a new object with the specified prototype object and properties.
Object.defineProperty()
Adds the named property described by a given descriptor to an object.
Object.defineProperties()
Adds the named properties described by the given descriptors to an object.
Object.entries()
Returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties.
Object.freeze()
Freezes an object. Other code cannot delete or change its properties.
Object.fromEntries()
Returns a new object from an iterable of [key, value] pairs. (This is the reverse of Object.entries).
Object.getOwnPropertyDescriptor()
Returns a property descriptor for a named property on an object.
Object.getOwnPropertyDescriptors()
Returns an object containing all own property descriptors for an object.
Object.getOwnPropertyNames()
Returns an array containing the names of all of the given object's own enumerable and non-enumerable properties.
Object.getOwnPropertySymbols()
Returns an array of all symbol properties found directly upon a given object.
Object.getPrototypeOf()
Returns the prototype(internal [[Prototype]] property) of the specified object.
Object.is()
Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison).
Object.isExtensible()
Determines if extending of an object is allowed.
Object.isFrozen()
Determines if an object was frozen.
Object.isSealed()
Determines if an object is sealed.
Object.keys()
Returns an array containing the names of all of the given object's own enumerable string properties.
Object.preventExtensions()
Prevents any extensions of an object.
Object.seal()
Prevents other code from deleting properties of an object.
Object.setPrototypeOf()
Sets the object's prototype (its internal [[Prototype]] property).
Object.values()
Returns an array containing the values that correspond to all of a given object's own enumerable string properties.

Object prototype

hasOwnProperty()
Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain.
isPrototypeOf()
Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object.
propertyIsEnumerable()
Returns a boolean indicating if the internal ECMAScript [[Enumerable]] attribute is set.
toLocaleString()
Returns a string representing the object. This method is meant to be overridden by derived objects for locale-specific purposes.
valueOf()
Returns the primitive value of the specified object
toString()
Returns a string representation of the object

Function

lenght
Specifies the number of arguments expected by the function
name
The name of the function (readonly)
apply(thisArg [, argsArray])
Calls a function and sets its this to the provided thisArg. Arguments can be passed as an Array object.
bind(thisArg[, arg1[, arg2[, ...argN]]])
Creates a new function which, when called, has its this set to the provided thisArg. Optionally, a given sequence of arguments will be prepended to arguments provided the newly-bound function is called.
call()
Calls a function and sets its this to the provided value. Arguments can be passed as they are.

Array

length
Sets or returns the number of elements in an array
concat()
Joins two or more arrays, and returns a copy of the joined arrays
copyWithin()
Copies array elements within the array, to and from specified positions
entries()
Returns a key/value pair Array Iteration Object
every()
Checks if every element in an array pass a test
fill()
Fill the elements in an array with a static value
filter()
Creates a new array with every element in an array that pass a test
find()
Returns the value of the first element in an array that pass a test
findIndex()
Returns the index of the first element in an array that pass a test
forEach()
Calls a function for each array element
from()
Creates an array from an object
includes()
Check if an array contains the specified element
indexOf()
Search the array for an element and returns its position
isArray()
Checks whether an object is an array
join()
Joins all elements of an array into a string
keys()
Returns a Array Iteration Object, containing the keys of the original array
lastIndexOf()
Search the array for an element, starting at the end, and returns its position
map()
Creates a new array with the result of calling a function for each array element
pop()
Removes the last element of an array, and returns that element
push()
Adds new elements to the end of an array, and returns the new length
reduce()
Reduce the values of an array to a single value (going left-to-right)
reduceRight()
Reduce the values of an array to a single value (going right-to-left)
reverse()
Reverses the order of the elements in an array
shift()
Removes the first element of an array, and returns that element
slice()
Selects a part of an array, and returns the new array
some()
Checks if any of the elements in an array pass a test
sort()
Sorts the elements of an array
splice()
Adds/Removes elements from an array
unshift()
Adds new elements to the beginning of an array, and returns the new length

String

charAt()
Returns a character at a specified position inside a string
charCodeAt()
Gives you the Unicode of a character at that position
concat()
Concatenates (joins) two or more strings into one
endsWith()
determines whether a string ends with the characters of a specified string
includes()
determines whether one string may be found within another string
fromCharCode()
Returns a string created from the specified sequence of UTF-16 code units
indexOf()
Provides the position of the first occurrence of a specified text within a string
lastIndexOf()
Same as indexOf() but with the last occurrence, searching backward
localeCompare()
returns a number indicating whether a reference string comes before, or after, or is the same as the given string in sort order
match()
Retrieves the matches of a string against a search pattern
matchAll()
returns an iterator of all results matching a string against a regular expression, including capturing groups
normalize()
returns the Unicode Normalization Form of the string
padEnd()
pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length (applied from the end of the string)
padStart()
ads the current string with another string (multiple times, if needed) until the resulting string reaches the given length (applied from the start of the string)
repeat()
constructs and returns a new string which contains the specified number of copies of the string on which it was called, concatenated together
replace()
Find and replace specified text in a string
search()
Executes a search for a matching text and returns its position
slice()
Extracts a section of a string and returns it as a new string
split()
Splits a string object into an array of strings at a specified position
startsWith()
determines whether a string begins with the characters of a specified string
substring()
Also similar to slice() but can’t accept negative indices
toLowerCase() / toLocaleLowerCase()
Convert strings to lower case
toUpperCase() / toLocaleUpperCase()
Convert strings to upper case
trim()
removes whitespace from both ends of a string
trimEnd()
removes whitespace from the end of a string
trimStart()
removes whitespace from the beginning of a string

Math

E
Euler’s number
LN2
The natural logarithm of 2
LN10
Natural logarithm of 10
LOG2E
Base 2 logarithm of E
LOG10E
Base 10 logarithm of E
PI
The number PI
SQRT1_2
Square root of 1/2
SQRT2
The square root of 2
abs(x)
Returns the absolute (positive) value of x
acos(x)
The arccosine of x, in radians
asin(x)
Arcsine of x, in radians
atan(x)
The arctangent of x as a numeric value
atan2(y,x
Arctangent of the quotient of its arguments
ceil(x)
Value of x rounded up to its nearest integer
cos(x)
The cosine of x (x is in radians)
exp(x)
Value of Ex
floor(x)
The value of x rounded down to its nearest integer
log(x)
The natural logarithm (base E) of x
max(x,...,n)
Returns the number with the highest value
min(x,...,n)
Same for the number with the lowest value
pow(x,y)
X to the power of y
random()
Returns a random number between 0 and 1
round(x)
The value of x rounded to its nearest integer
sin(x)
The sine of x (x is in radians)
sqrt(x)
Square root of x
tan(x)
The tangent of an angle

Date

getDay()
The weekday as a number (0-6)
[get|set]Date()
Get/Set the day of the month as a number (1-31)
[get|set]FullYear()
Get year as a four-digit number (yyyy) / Sets the year (optionally month and day)
[get|set]Hours()
Get/Set the hour (0-23)
[get|set]Milliseconds()
Get/Set millisecond (0-999)
[get|set]Minutes()
Get/Set the minutes (0-59)
[get|set]Month()
Get/Set month as a number (0-11)
[get|set]Seconds()
Get/Set the seconds (0-59)
[get|set]Time()
Get/Set the milliseconds since January 1, 1970
[get|set]UTCDate()
Get/Set the day (date) of the month in the specified date according to universal time (also available for day, month, full year, hours, minutes etc.)
parse
Parses a string representation of a date and returns the number of milliseconds since January 1, 1970

Promise

catch()
Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.
then()
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler, or to its original settled value if the promise was not handled (i.e. if the relevant handler onFulfilled or onRejected is not a function).
finally()
Appends a handler to the promise, and returns a new promise which is resolved when the original promise is resolved. The handler is called when the promise is settled, whether fulfilled or rejected.
Promise.all(iterable)
Wait for all promises to be resolved, or for any to be rejected.
If the returned promise resolves, it is resolved with an aggregating array of the values from the resolved promises ,in the same order as defined in the iterable of multiple promises.
If it rejects, it is rejected with the reason from the first promise in the iterable that was rejected.
Promise.allSettled(iterable)
Wait until all promises have settled (each may resolve or reject).
Returns a promise that resolves after all of the given promises have either resolved or rejected, with an array of objects that each describe the outcome of each promise.
Promise.race(iterable)
Wait until any of the promises is resolved or rejected.
If the returned promise resolves, it is resolved with the value of the first promise in the iterable that resolved.
If it rejects, it is rejected with the reason from the first promise that was rejected.
Promise.reject(reason)
Returns a new Promise object that is rejected with the given reason.
Promise.resolve(value)
Returns a new Promise object that is resolved with the given value. If the value is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the value.
Generally, if you don't know if a value is a promise or not, Promise.resolve(value) it instead and work with the return value as a promise.

TypeScript

Utility Types

type Partial<T> = { [P in keyof T]?: T[P]; };
Make all properties in T optional
type Required<T> = { [P in keyof T]-?: T[P]; };
Make all properties in T required
type Readonly<T> = { readonly [P in keyof T]: T[P]; };
Make all properties in T readonly
type Pick<T, K extends keyof T> = { [P in K]: T[P]; };
From T, pick a set of properties whose keys are in the union K
type Record<K extends keyof any, T> = { [P in K]: T; };
Construct a type with a set of properties K of type T
type Exclude<T, U> = T extends U ? never : T;
Exclude from T those types that are assignable to U
type Extract<T, U> = T extends U ? T : never;
Extract from T those types that are assignable to U
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
Construct a type with the properties of T except for those in type K.
type NonNullable<T> = T extends null | undefined ? never : T;
Exclude null and undefined from T
type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
Obtain the parameters of a function type in a tuple
type ConstructorParameters<T extends new (...args: any) => any> = T extends new (...args: infer P) => any ? P : never;
Obtain the parameters of a constructor function type in a tuple
type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
Obtain the return type of a function type
type InstanceType<T extends new (...args: any) => any> = T extends new (...args: any) => infer R ? R : any;
Obtain the return type of a constructor function type
ThisType<T>
This utility does not return a transformed type. Instead, it serves as a marker for a contextual this type. Note that the --noImplicitThis flag must be enabled to use this utility.

React

React Component Lifecycle

Mounting Updating Error boundaries Unmounting
Render phase constructor
getDerivedStateFromProps getDerivedStateFromError
shoulComponentUpdate
render
Pre-commit phase getSnapshotBeforeUpdate
Commit phase React updates DOM and refs
componentDidMount componentDidUpdate componentDidCatch componentWillUnmount
Render phase
Pure and has no side effects. May be paused, aborted or restarted by React.
Pre-commit phase
Can read the DOM.
Commit phase
Can work with DOM, run side effects, schedule updates.

constructor(props)
render()
static getDerivedStateFromProps(props, state)
static getDerivedStateFromError(error)
shoulComponentUpdate(nextProps, nextState)
getSnapshotBeforeUpdate(prevProps, prevState)
componentDidMount()
componentDidUpdate(prevProps, prevState, snapshot)
componentDidCatch(error, info)
componentWillUnmount()

React

React.Component
React.Component is the base class for React components when they are defined using ES6 classes
React.PureComponent
React.PureComponent is similar to React.Component. The difference between them is that React.Component doesn’t implement shouldComponentUpdate(), but React.PureComponent implements it with a shallow prop and state comparison.
React.PureComponent’s shouldComponentUpdate() only shallowly compares the objects. If these contain complex data structures, it may produce false-negatives for deeper differences. Only extend PureComponent when you expect to have simple props and state, or use forceUpdate() when you know deep data structures have changed. Or, consider using immutable objects to facilitate fast comparisons of nested data.
Furthermore, React.PureComponent’s shouldComponentUpdate() skips prop updates for the whole component subtree. Make sure all the children components are also “pure”.
React.memo(component, areEqual)
React.memo is a higher order component. It’s similar to React.PureComponent but for function components instead of classes.
If your function component renders the same result given the same props, you can wrap it in a call to React.memo for a performance boost in some cases by memoizing the result. This means that React will skip rendering the component, and reuse the last rendered result.
By default it will only shallowly compare complex objects in the props object. If you want control over the comparison, you can also provide a custom comparison function as the second argument.
Unlike the shouldComponentUpdate() method on class components, the areEqual function returns true if the props are equal and false if the props are not equal. This is the inverse from shouldComponentUpdate.
React.createElement(type, [props], [...children])
Create and return a new React element of the given type. The type argument can be either a tag name string, a React component type (a class or a function), or a React fragment type.
React.cloneElement(element, [props], [...children])
Clone and return a new React element using element as the starting point. The resulting element will have the original element’s props with the new props merged in shallowly. New children will replace existing children. key and ref from the original element will be preserved.
However, it also preserves refs. This means that if you get a child with a ref on it, you won’t accidentally steal it from your ancestor. You will get the same ref attached to your new element.
React.createFactory(type)
Return a function that produces React elements of a given type. Like React.createElement(), the type argument can be either a tag name string, a React component type (a class or a function), or a React fragment type.
This helper is considered legacy, and we encourage you to either use JSX or use React.createElement() directly instead.
React.isValidElement(object)
Verifies the object is a React element. Returns true or false.
React.Fragment
The React.Fragment component lets you return multiple elements in a render() method without creating an additional DOM element (the shorthand <></> syntax)
React.createRef
React.createRef creates a ref that can be attached to React elements via the ref attribute.
React.forwardRef((props, ref) => ())
React.forwardRef creates a React component that forwards the ref attribute it receives to another component below in the tree.
React.forwardRef accepts a rendering function as an argument. React will call this function with props and ref as two arguments. This function should return a React node.
React.lazy()
React.lazy() lets you define a component that is loaded dynamically. This helps reduce the bundle size to delay loading components that aren’t used during the initial render. Note that rendering lazy components requires that there’s a <React.Suspense> component higher in the rendering tree. This is how you specify a loading indicator.
React.Suspense
React.Suspense let you specify the loading indicator in case some components in the tree below it are not yet ready to render. Today, lazy loading components is the only use case supported by <React.Suspense>

React.Component

constructor(props)
If you don’t initialize state and you don’t bind methods, you don’t need to implement a constructor for your React component.
The constructor for a React component is called before it is mounted. When implementing the constructor for a React.Component subclass, you should call super(props) before any other statement. Otherwise, this.props will be undefined in the constructor, which can lead to bugs.
Typically, in React constructors are only used for two purposes: initializing local state by assigning an object to this.state, binding event handler methods to an instance.
render()
The render() method is the only required method in a class component.
When called, it should examine this.props and this.state and return one of the following types:
  • React elements. Typically created via JSX.
  • Arrays and fragments. Let you return multiple elements from render.
  • Portals. Let you render children into a different DOM subtree.
  • String and numbers. These are rendered as text nodes in the DOM.
  • Booleans or null. Render nothing.
The render() function should be pure, meaning that it does not modify component state, it returns the same result each time it’s invoked, and it does not directly interact with the browser.
static getDerivedStateFromProps(props, state)
getDerivedStateFromProps is invoked right before calling the render method, both on the initial mount and on subsequent updates. It should return an object to update the state, or null to update nothing.
static getDerivedStateFromError(error)
This lifecycle is invoked after an error has been thrown by a descendant component. It receives the error that was thrown as a parameter and should return a value to update state.
getDerivedStateFromError() is called during the “render” phase, so side-effects are not permitted. For those use cases, use componentDidCatch() instead.
shoulComponentUpdate(nextProps, nextState)
Use shouldComponentUpdate() to let React know if a component’s output is not affected by the current change in state or props.
shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true. This method is not called for the initial render or when forceUpdate() is used.
Note that returning false does not prevent child components from re-rendering when their state changes.
If shouldComponentUpdate() returns false, then UNSAFE_componentWillUpdate(), render(), and componentDidUpdate() will not be invoked. In the future React may treat shouldComponentUpdate() as a hint rather than a strict directive, and returning false may still result in a re-rendering of the component.
getSnapshotBeforeUpdate(prevProps, prevState)
getSnapshotBeforeUpdate() is invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture some information from the DOM before it is potentially changed. Any value returned by this lifecycle will be passed as a parameter to componentDidUpdate().
componentDidMount()
componentDidMount() is invoked immediately after a component is mounted (inserted into the tree). Initialization that requires DOM nodes should go here. If you need to load data from a remote endpoint, this is a good place to instantiate the network request.
You may call setState() immediately in componentDidMount(). It will trigger an extra rendering, but it will happen before the browser updates the screen. This guarantees that even though the render() will be called twice in this case, the user won’t see the intermediate state. Use this pattern with caution because it often causes performance issues. In most cases, you should be able to assign the initial state in the constructor() instead. It can, however, be necessary for cases like modals and tooltips when you need to measure a DOM node before rendering something that depends on its size or position.
componentDidUpdate(prevProps, prevState, snapshot)
componentDidUpdate() is invoked immediately after updating occurs. This method is not called for the initial render.
componentDidUpdate() will not be invoked if shouldComponentUpdate() returns false.
componentDidCatch(error, info)
This lifecycle is invoked after an error has been thrown by a descendant component. It receives two parameters: error - the error that was thrown, info - an object with a componentStack key containing information about which component threw the error.
componentDidCatch() is called during the “commit” phase, so side-effects are permitted. It should be used for things like logging errors
In the event of an error, you can render a fallback UI with componentDidCatch() by calling setState, but this will be deprecated in a future release. Use static getDerivedStateFromError() to handle fallback rendering instead.
componentWillUnmount()
componentWillUnmount() is invoked immediately before a component is unmounted and destroyed. Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests, or cleaning up any subscriptions that were created in componentDidMount().

Other APIs

setState(updater: (state, props) => stateChange | stateChange, callback?)
Enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state. This is the primary method you use to update the user interface in response to event handlers and server responses.
forceUpdate()
Calling forceUpdate() will cause render() to be called on the component, skipping shouldComponentUpdate().

Class Properties

defaultProps
defaultProps can be defined as a property on the component class itself, to set the default props for the class. This is used for undefined props, but not for null props.
displayName
The displayName string is used in debugging messages. Usually, you don’t need to set it explicitly because it’s inferred from the name of the function or class that defines the component. You might want to set it explicitly if you want to display a different name for debugging purposes or when you create a higher-order component

Instance Properties

props
Contains the props that were defined by the caller of this component. In particular, this.props.children is a special prop, typically defined by the child tags in the JSX expression rather than in the tag itself.
state
The state contains data specific to this component that may change over time. The state is user-defined, and it should be a plain JavaScript object.
If some value isn’t used for rendering or data flow (for example, a timer ID), you don’t have to put it in the state. Such values can be defined as fields on the component instance.
Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made. Treat this.state as if it were immutable.

React.Children

React.Children.map(children, function[(thisArg)])
Invokes a function on every immediate child contained within children with this set to thisArg. If children is an array it will be traversed and the function will be called for each child in the array. If children is null or undefined, this method will return null or undefined rather than an array. If children is a Fragment it will be treated as a single child and not traversed.
React.Children.forEach(children, function[(thisArg)])
Like React.Children.map() but does not return an array.
React.Children.count(children)
Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked.
React.Children.only(children)
Verifies that children has only one child (a React element) and returns it. Otherwise this method throws an error. React.Children.only() does not accept the return value of React.Children.map() because it is an array rather than a React element.
React.Children.toArray(children)
Returns the children opaque data structure as a flat array with keys assigned to each child. Useful if you want to manipulate collections of children in your render methods, especially if you want to reorder or slice this.props.children before passing it down. React.Children.toArray() changes keys to preserve the semantics of nested arrays when flattening lists of children. That is, toArray prefixes each key in the returned array so that each element’s key is scoped to the input array containing it.

ReactDOM

ReactDOM.render(element, container[, callback])
Render a React element into the DOM in the supplied container and return a reference to the component (or returns null for stateless components).
If the React element was previously rendered into container, this will perform an update on it and only mutate the DOM as necessary to reflect the latest React element.
If the optional callback is provided, it will be executed after the component is rendered or updated.
ReactDOM.hydrate(element, container[, callback])
Same as render(), but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer. React will attempt to attach event listeners to the existing markup.
ReactDOM.unmountComponentAtNode(container)
Remove a mounted React component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing. Returns true if a component was unmounted and false if there was no component to unmount.
ReactDOM.findDOMNode(component)
If this component has been mounted into the DOM, this returns the corresponding native browser DOM element. This method is useful for reading values out of the DOM, such as form field values and performing DOM measurements. In most cases, you can attach a ref to the DOM node and avoid using findDOMNode at all. When a component renders to null or false, findDOMNode returns null. When a component renders to a string, findDOMNode returns a text DOM node containing that value. As of React 16, a component may return a fragment with multiple children, in which case findDOMNode will return the DOM node corresponding to the first non-empty child. findDOMNode only works on mounted components (that is, components that have been placed in the DOM). If you try to call this on a component that has not been mounted yet (like calling findDOMNode() in render() on a component that has yet to be created) an exception will be thrown. findDOMNode cannot be used on function components. It has been deprecated in StrictMode.
ReactDOM.createPortal(child, container)
Creates a portal. Portals provide a way to render children into a DOM node that exists outside the hierarchy of the DOM component.

ReactDOMServer

ReactDOMServer.renderToString(element)
Render a React element to its initial HTML. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
If you call ReactDOM.hydrate() on a node that already has this server-rendered markup, React will preserve it and only attach event handlers, allowing you to have a very performant first-load experience.
ReactDOMServer.renderToStaticMarkup(element)
Similar to renderToString, except this doesn’t create extra DOM attributes that React uses internally, such as data-reactroot. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save some bytes.
If you plan to use React on the client to make the markup interactive, do not use this method. Instead, use renderToString on the server and ReactDOM.hydrate() on the client.
ReactDOMServer.renderToNodeStream(element)
Render a React element to its initial HTML. Returns a Readable stream that outputs an HTML string. The HTML output by this stream is exactly equal to what ReactDOMServer.renderToString would return.
ReactDOMServer.renderToStaticNodeStream(element)
The HTML output by this stream is exactly equal to what ReactDOMServer.renderToStaticMarkup would return.

DOM Elements

All DOM properties and attributes (including event handlers) should be camelCased. For example, the HTML attribute tabindex corresponds to the attribute tabIndex in React. The exception is aria-* and data-* attributes, which should be lowercased. For example, you can keep aria-label as aria-label.

checked
The checked attribute is supported by <input> components of type checkbox or radio. You can use it to set whether the component is checked. This is useful for building controlled components. defaultChecked is the uncontrolled equivalent, which sets whether the component is checked when it is first mounted.
className
To specify a CSS class, use the className attribute. This applies to all regular DOM and SVG elements. If you use React with Web Components (which is uncommon), use the class attribute instead.
dangerouslySetInnerHTML
dangerouslySetInnerHTML is React’s replacement for using innerHTML in the browser DOM. In general, setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack. So, you can set HTML directly from React, but you have to type out dangerouslySetInnerHTML and pass an object with a __html key, to remind yourself that it’s dangerous.
htmlFor
Since for is a reserved word in JavaScript, React elements use htmlFor instead.
onChange
The onChange event behaves as you would expect it to: whenever a form field is changed, this event is fired. We intentionally do not use the existing browser behavior because onChange is a misnomer for its behavior and React relies on this event to handle user input in real time.
selected
The selected attribute is supported by <option> components. You can use it to set whether the component is selected. This is useful for building controlled components.
style
The style attribute accepts a JavaScript object with camelCased properties rather than a CSS string. This is consistent with the DOM style JavaScript property, is more efficient, and prevents XSS security holes.
suppressContentEditableWarning
Normally, there is a warning when an element with children is also marked as contentEditable, because it won’t work. This attribute suppresses that warning. Don’t use this unless you are building a library like Draft.js that manages contentEditable manually.
suppressHydrationWarning
If you use server-side React rendering, normally there is a warning when the server and the client render different content. However, in some rare cases, it is very hard or impossible to guarantee an exact match. For example, timestamps are expected to differ on the server and on the client.
If you set suppressHydrationWarning to true, React will not warn you about mismatches in the attributes and the content of that element. It only works one level deep, and is intended to be used as an escape hatch.
value
The value attribute is supported by <input> and <textarea> components. You can use it to set the value of the component. This is useful for building controlled components. defaultValue is the uncontrolled equivalent, which sets the value of the component when it is first mounted.

Test Utilities

act()
To prepare a component for assertions, wrap the code rendering it and performing updates inside an act() call. This makes your test run closer to how React works in the browser.
mockComponent(componentClass, [mockTagName])
Pass a mocked component module to this method to augment it with useful methods that allow it to be used as a dummy React component. Instead of rendering as usual, the component will become a simple <div> (or other tag if mockTagName is provided) containing any provided children. mockComponent() is a legacy API (use jest.mock() instead)
isElement(element)
Returns true if element is any React element.
isElementOfType(element, componentClass)
Returns true if element is a React element whose type is of a React componentClass.
isDOMComponent(instance)
Returns true if instance is a DOM component
isCompositeComponent(instance)
Returns true if instance is a user-defined component, such as a class or a function.
isCompositeComponentWithType(instance, componentClass)
Returns true if instance is a component whose type is of a React componentClass.
findAllInRenderedTree(tree, test)
Traverse all components in tree and accumulate all components where test(component) is true.
scryRenderedDOMComponentsWithClass(tree, className)
Finds all DOM elements of components in the rendered tree that are DOM components with the class name matching className.
findRenderedDOMComponentWithClass(tree, className)
Like scryRenderedDOMComponentsWithClass() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.
scryRenderedDOMComponentsWithTag(tree, tagName)
Finds all DOM elements of components in the rendered tree that are DOM components with the tag name matching tagName.
findRenderedDOMComponentWithTag(tree, tagName)
Like scryRenderedDOMComponentsWithTag() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.
scryRenderedComponentsWithType(tree, componentClass)
Finds all instances of components with type equal to componentClass.
findRenderedComponentWithType(tree, componentClass)
Same as scryRenderedComponentsWithType() but expects there to be one result and returns that one result, or throws exception if there is any other number of matches besides one.
renderIntoDocument(element)
Render a React element into a detached DOM node in the document. This function requires a DOM.
Simulate.{eventName}(element, [eventData])
Simulate an event dispatch on a DOM node with optional eventData event data.

Hooks

useState
Returns a stateful value, and a function to update it.
useEffect
Accepts a function that contains imperative, possibly effectful code. The function passed to useEffect will run after the render is committed to the screen. By default, effects run after every completed render, but you can choose to fire it only when certain values have changed.
useContext
Accepts a context object (the value returned from React.createContext) and returns the current context value for that context. The current context value is determined by the value prop of the nearest <MyContext.Provider>> above the calling component in the tree. When the nearest <MyContext.Provider> above the component updates, this Hook will trigger a rerender with the latest context value passed to that MyContext provider.
useReducer
Accepts a reducer of type (state, action) => newState, and returns the current state paired with a dispatch method.
useCallback
Returns a memoized callback. Pass an inline callback and an array of dependencies. useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed. useCallback(fn, deps) is equivalent to useMemo(() => fn, deps).
useMemo
Returns a memoized value. Pass a “create” function and an array of dependencies. useMemo will only recompute the memoized value when one of the dependencies has changed. This optimization helps to avoid expensive calculations on every render. If no array is provided, a new value will be computed on every render.
useRef
Returns a mutable ref object whose .current property is initialized to the passed argument (initialValue). The returned object will persist for the full lifetime of the component.
useImperativeHandle
Customizes the instance value that is exposed to parent components when using ref.
useLayoutEffect
The signature is identical to useEffect, but it fires synchronously after all DOM mutations. Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside useLayoutEffect will be flushed synchronously, before the browser has a chance to paint.
useDebugValue
Can be used to display a label for custom hooks in React DevTools

React Patterns

Function component
Destructuring props
JSX spread attributes
Merge destructured props with other values
Conditional rendering
Children types
Array as children
Function as children
Render prop
Children pass-through
Proxy component
Style component
Event switch
Layout component
Container component
Higher-order component
State hoisting
Controlled input

HTML

Basic

!DOCTYPE
Defines the document type
html
Defines an HTML document
head
Defines information about the document
title
Defines a title for the document
body
Defines the document's body
h1 to h6
Defines HTML headings
p
Defines a paragraph
br
Inserts a single line break
hr
Defines a thematic change in the content
<!--...-->
Defines a comment

Formating

abbr
Defines an abbreviation or an acronym
address
Defines contact information for the author/owner of a document/article
b
Defines bold text
bdi
Isolates a part of text that might be formatted in a different direction from other text outside it
bdo
Overrides the current text direction
blockquote
Defines a section that is quoted from another source
cite
Defines the title of a work
code
Defines a piece of computer code
del
Defines text that has been deleted from a document
dfn
Represents the defining instance of a term
em
Defines emphasized text
i
Defines a part of text in an alternate voice or mood
ins
Defines a text that has been inserted into a document
kbd
Defines keyboard input
mark
Defines marked/highlighted text
meter
Defines a scalar measurement within a known range (a gauge)
pre
Defines preformatted text
progress
Represents the progress of a task
q
Defines a short quotation
rp
Defines what to show in browsers that do not support ruby annotations
rt
Defines an explanation/pronunciation of characters (for East Asian typography)
ruby
Defines a ruby annotation (for East Asian typography)
s
Defines text that is no longer correct
samp
Defines sample output from a computer program
small
Defines smaller text
strong
Defines important text
sub
Defines subscripted text
sup
Defines superscripted text
template
Defines a template
time
Defines a date/time
u
Defines text that should be stylistically different from normal text
var
Defines a variable
wbr
Defines a possible line-break

Forms and input

form
Defines an HTML form for user input
input
Defines an input control
textarea
Defines a multiline input control (text area)
button
Defines a clickable button
select
Defines a drop-down list
optgroup
Defines a group of related options in a drop-down list
option
Defines an option in a drop-down list
label
Defines a label for an <input> element
fieldset
Groups related elements in a form
legend
Defines a caption for a <fieldset> element
datalist
Specifies a list of pre-defined options for input controls
output
Defines the result of a calculation

Frames

iframe
Defines an inline frame

Images

img
Defines an image
map
Defines a client-side image-map
area
Defines an area inside an image-map
canvas
Used to draw graphics, on the fly, via scripting (usually JavaScript)
figcaption
Defines a caption for a <figure> element
figure
Specifies self-contained content
picture
Defines a container for multiple image resources
svg
Defines a container for SVG graphics

Audio&Video

audio
Defines sound content
source
Defines multiple media resources for media elements (<video>, <audio> and <picture>)
track
Defines text tracks for media elements (<video> and <audio>)
video
Defines a video or movie

Links

a
Defines a hyperlink
link
Defines the relationship between a document and an external resource (most used to link to style sheets)
nav
Defines navigation links

Lists

ul
Defines an unordered list
ol
Defines an ordered list
li
Defines a list item
dl
Defines a description list
dt
Defines a term/name in a description list
dd
Defines a description of a term/name in a description list

Tables

table
Defines a table
caption
Defines a table caption
th
Defines a header cell in a table
tr
Defines a row in a table
td
Defines a cell in a table
thead
Groups the header content in a table
tbody
Groups the body content in a table
tfoot
Groups the footer content in a table
col
Specifies column properties for each column within a <colgroup> element
colgroup
Specifies a group of one or more columns in a table for formatting

Tips:

  • Use the CSS border property to define a border
  • Use the CSS border-collapse property to collapse cell borders
  • Use the CSS padding property to add padding to cells
  • Use the CSS border-spacing property to set the spacing between cells
  • Use the colspan attribute to make a cell span many columns
  • Use the rowspan attribute to make a cell span many rows

Styles&Semantics

style
Defines style information for a document
div
Defines a section in a document
span
Defines a section in a document
header
Defines a header for a document or section
footer
Defines a footer for a document or section
main
Specifies the main content of a document
section
Defines a section in a document
article
Defines an article
aside
Defines content aside from the page content
details
Defines additional details that the user can view or hide
dialog
Defines a dialog box or window
summary
Defines a visible heading for a <details> element
data
Links the given content with a machine-readable translation

Meta Info

head
Defines information about the document
meta
Defines metadata about an HTML document
base
Specifies the base URL/target for all relative URLs in a document

Programming

script
Defines a client-side script
noscript
Defines an alternate content for users that do not support client-side scripts
embed
Defines a container for an external (non-HTML) application
object
Defines an embedded object
param
Defines a parameter for an object

Global Attributes

accesskey
Specifies a shortcut key to activate/focus an element
class
Specifies one or more classnames for an element (refers to a class in a style sheet)
contenteditable
Specifies whether the content of an element is editable or not
data-*
Used to store custom data private to the page or application
dir
Specifies the text direction for the content in an element
draggable
Specifies whether an element is draggable or not
dropzone
Specifies whether the dragged data is copied, moved, or linked, when dropped
hidden
Specifies that an element is not yet, or is no longer, relevant
id
Specifies a unique id for an element
lang
Specifies the language of the element's content
spellcheck
Specifies whether the element is to have its spelling and grammar checked or not
style
Specifies an inline CSS style for an element
tabindex
Specifies the tabbing order of an element
title
Specifies extra information about an element
translate
Specifies whether the content of an element should be translated or not

Other Attributes

Script&Meta

async
(<script>) Specifies that the script is executed asynchronously (only for external scripts)
defer
(<script>) Specifies that the script is executed when the page has finished parsing (only for external scripts)
charset
(<meta>, <script>) Specifies the character encoding
content
(<meta>) Gives the value associated with the http-equiv or name attribute
http-equiv
(<meta>) Provides an HTTP header for the information/value of the content attribute

Body

onafterprint
Script to be run after the document is printed
onbeforeprint
Script to be run before the document is printed
onbeforeunload
Script to be run when the document is about to be unloaded
onhashchange
Script to be run when there has been changes to the anchor part of the a URL
onoffline
Script to be run when the browser starts to work offline
ononline
Script to be run when the browser starts to work online
onpagehide
Script to be run when a user navigates away from a page
onpageshow
Script to be run when a user navigates to a page
onpopstate
Script to be run when the window's history changes.
onresize
Script to be run when the browser window is being resized.
onstorage
Script to be run when a Web Storage area is updated
onunload
Script to be run when a page has unloaded (or the browser window has been closed)

Loadable resource

onerror
(<audio>, <body>, <embed>, <img>, <object>, <script>, <style>, <video>) Script to be run when an error occurs
onload
(<body>, <iframe>, <img>, <input>, <link>, <script>, <style>) Script to be run when the element is finished loading

Forms

accept-charset
(<form>) Specifies the character encodings that are to be used for the form submission
enctype
(<form>) Specifies how the form-data should be encoded when submitting it to the server (only for method="post")
accept
(<input>) Specifies the types of files that the server accepts (only for type="file")
action
(<form>) Specifies where to send the form-data when a form is submitted
method
(<form>) Specifies the HTTP method to use when sending form-data
novalidate
(<form>) Specifies that the form should not be validated when submitted
onreset
(<form>) Script to be run when a reset button in a form is clicked.
onsubmit
(<form>) Script to be run when a form is submitted
alt
(<area>, <img>, <input>) Specifies an alternate text when the original element fails to display
autocomplete
(<form>, <input>) Specifies whether the <form> or the <input> element should have autocomplete enabled
autofocus
(<button>, <input>, <select>, <textarea>) Specifies that the element should automatically get focus when the page loads
checked
(<input>) Specifies that an <input> element should be pre-selected when the page loads (for type="checkbox" or type="radio")
cols
(<textarea>) Specifies the visible width of a text area
dirname
(<input>, <textarea>) Specifies that the text direction will be submitted
disabled
(<button>, <fieldset>, <input>, <optgroup>, <option>, <select>, <textarea>) Specifies that the specified element/group of elements should be disabled
for
(<label>, <output>) Specifies which form element(s) a label/calculation is bound to
form
(<button>, <fieldset>, <input>, <label>, <meter>, <object>, <output>, <select>, <textarea>) Specifies the name of the form the element belongs to
formaction
(<button>, <input>) Specifies where to send the form-data when a form is submitted. Only for type="submit"
list
(<input>) Refers to a <datalist> element that contains pre-defined options for an <input> element
maxlength
(<input>, <textarea>) Specifies the maximum number of characters allowed in an element
multiple
(<input>, <select>) Specifies that a user can enter more than one value
name
(<button>, <fieldset>, <form>, <iframe>, <input>, <map>, <meta>, <object>, <output>, <param>, <select>, <textarea>) Specifies the name of the element
onsearch
(<input>) Script to be run when the user writes something in a search field (for <input="search">)
pattern
(<input>) Specifies a regular expression that an <input> element's value is checked against
placeholder
(<input>, <textarea>) Specifies a short hint that describes the expected value of the element
readonly
(<input>, <textarea>) Specifies that the element is read-only
required
(<input>, <select>, <textarea>) Specifies that the element must be filled out before submitting the form
rows
(<textarea>) Specifies the visible number of lines in a text area
step
(<input>) Specifies the legal number intervals for an input field
size
(<input>, <select>) Specifies the width, in characters (for <input>) or specifies the number of visible options (for <select>)
wrap
(<textarea>) Specifies how the text in a text area is to be wrapped when submitted in a form

Audio&Video

autoplay
(<audio>, <video>) Specifies that the audio/video will start playing as soon as it is ready
controls
(<audio>, <video>) Specifies that audio/video controls should be displayed (such as a play/pause button etc)
loop
(<audio>, <video>) Specifies that the audio/video will start over again, every time it is finished
muted
(<video>, <audio>) Specifies that the audio output of the video should be muted
onabort
(<audio>, <embed>, <img>, <object>, <video>) Script to be run on abort
oncanplay
(<audio>, <embed>, <object>, <video>) Script to be run when a file is ready to start playing (when it has buffered enough to begin)
oncanplaythrough
(<audio>, <video>) Script to be run when a file can be played all the way to the end without pausing for buffering
ondurationchange
(<audio>, <video>) Script to be run when the length of the media changes
onemptied
(<audio>, <video>) Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects)
onended
(<audio>, <video>) Script to be run when the media has reach the end (a useful event for messages like "thanks for listening")
onloadeddata
(<audio>, <video>) Script to be run when media data is loaded
onloadedmetadata
(<audio>, <video>) Script to be run when meta data (like dimensions and duration) are loaded
onloadstart
(<audio>, <video>) Script to be run just as the file begins to load before anything is actually loaded
onpause
(<audio>, <video>) Script to be run when the media is paused either by the user or programmatically
onplay
(<audio>, <video>) Script to be run when the media has started playing
onplaying
(<audio>, <video>) Script to be run when the media has started playing
onprogress
(<audio>, <video>) Script to be run when the browser is in the process of getting the media data
onratechange
(<audio>, <video>) Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode).
onseeked
(<audio>, <video>) Script to be run when the seeking attribute is set to false indicating that seeking has ended
onseeking
(<audio>, <video>) Script to be run when the seeking attribute is set to true indicating that seeking is active
onstalled
(<audio>, <video>) Script to be run when the browser is unable to fetch the media data for whatever reason
onsuspend
(<audio>, <video>) Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason
ontimeupdate
(<audio>, <video>) Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media)
onvolumechange
(<audio>, <video>) Script to be run each time the volume of a video/audio has been changed
onwaiting
(<audio>, <video>) Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data)
poster
(<video>) Specifies an image to be shown while the video is downloading, or until the user hits the play button
preload
(<audio>, <video>) Specifies if and how the author thinks the audio/video should be loaded when the page loads
default
(<track>) Specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate
kind
(<track>) Specifies the kind of text track
oncuechange
(<track>) Script to be run when the cue changes in a <track> element
srclang
(<track>) Specifies the language of the track text data (required if kind="subtitles")

Table

colspan
(<td>, <th>) Specifies the number of columns a table cell should span
headers
(<td>, <th>) Specifies one or more headers cells a cell is related to
rowspan
(<td>, <th>) Specifies the number of rows a table cell should span
scope
(<th>) Specifies whether a header cell is a header for a column, row, or group of columns or rows
span
(<col>, <colgroup>) Specifies the number of columns to span

All visible elements

onblur
Script to be run when the element loses focus
onchange
Script to be run when the value of the element is changed
onclick
Script to be run when the element is being clicked
oncontextmenu
Script to be run when a context menu is triggered
oncopy
Script to be run when the content of the element is being copied
oncut
Script to be run when the content of the element is being cut
ondblclick
Script to be run when the element is being double-clicked
ondrag
Script to be run when the element is being dragged
ondragend
Script to be run at the end of a drag operation
ondragenter
Script to be run when an element has been dragged to a valid drop target
ondragleave
Script to be run when an element leaves a valid drop target
ondragover
Script to be run when an element is being dragged over a valid drop target
ondragstart
Script to be run at the start of a drag operation
ondrop
Script to be run when dragged element is being dropped
onfocus
Script to be run when the element gets focus
oninput
Script to be run when the element gets user input
oninvalid
Script to be run when the element is invalid
onkeydown
Script to be run when a user is pressing a key
onkeypress
Script to be run when a user presses a key
onkeyup
Script to be run when a user releases a key
onmousedown
Script to be run when a mouse button is pressed down on an element
onmousemove
Script to be run as long as the mouse pointer is moving over an element
onmouseout
Script to be run when a mouse pointer moves out of an element
onmouseover
Script to be run when a mouse pointer moves over an element
onmouseup
Script to be run when a mouse button is released over an element
onmousewheel
Script to be run when a mouse wheel is being scrolled over an element
onpaste
Script to be run when the user pastes some content in an element
onscroll
Script to be run when an element's scrollbar is being scrolled
onselect
Script to be run when the element gets selected
onwheel
Script to be run when the mouse wheel rolls up or down over an element

Other

download
(<a>, <area>) Specifies that the target will be downloaded when a user clicks on the hyperlink
rel
(<a>, <area>, <link>) Specifies the relationship between the current document and the linked document
coords
(<area>) Specifies the coordinates of the area
shape
(<area>) Specifies the shape of the area
ontoggle
(<details>) Script to be run when the user opens or closes the <details> element
open
(<details>) Specifies that the details should be visible (open) to the user
reversed
(<ol>) Specifies that the list order should be descending (9,8,7...)
start
(<ol>) Specifies the start value of an ordered list
cite
(<blockquote>, <del>, <ins>, <q>) Specifies a URL which explains the quote/deleted/inserted text
datetime
(<del>, <ins>, <time>) Specifies the date and time
data
(<object>) Specifies the URL of the resource to be used by the object
height
(<canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>) Specifies the height of the element
high
(<meter>) Specifies the range that is considered to be a high value
href
(<a>, <area>, <base>, <link>) Specifies the URL of the page the link goes to
hreflang
(<a>, <area>, <link>) Specifies the language of the linked document
ismap
(<img>) Specifies an image as a server-side image-map
max
(<input>, <meter>, <progress>) Specifies the maximum value
label
(<track>, <option>, <optgroup>) Specifies the title of the text track
low
(<meter>) Specifies the range that is considered to be a low value
media
(<a>, <area>, <link>, <source>, <style>) Specifies what media/device the linked document is optimized for
min
(<input>, <meter>) Specifies a minimum value
optimum
(<meter>) Specifies what value is the optimal value for the gauge
sandbox
(<iframe>) Enables an extra set of restrictions for the content in an <iframe>
selected
(<option>) Specifies that an option should be pre-selected when the page loads
sizes
(<img>, <link>, <source>) Specifies the size of the linked resource
src
(<audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video>) Specifies the URL of the media file
srcdoc
(<iframe>) Specifies the HTML content of the page to show in the <iframe>
srcset
(<img>, <source>) Specifies the URL of the image to use in different situations
target
(<a>, <area>, <base>, <form>) Specifies the target for where to open the linked document or where to submit the form
type
(<a>, <button>, <embed>, <input>, <link>, <menu>, <object>, <script>, <source>, <style>) Specifies the type of element
usemap
(<img>, <object>) Specifies an image as a client-side image-map
value
(<button>, <input>, <li>, <option>, <meter>, <progress>, <param>) Specifies the value of the element
width
(<canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>) Specifies the width of the element

CSS

Selectors

Universal selector (* ns|* *|*)
Selects all elements. Optionally, it may be restricted to a specific namespace or to all namespaces.
Type selector (elemname)
Selects all elements that have the given node name.
Class selector (.classname)
Selects all elements that have the given class attribute.
ID selector (#idname)
Selects an element based on the value of its id attribute. There should be only one element with a given ID in a document.
Attribute selector ([attr])
Selects all elements that have the given attribute.
[attr=value]
attribute value equal to
[attr~=value]
attribute value contains the word
[attr|=value]
attribute value starting with
[attr^=value]
attribute value begins with
[attr$=value]
attribute value ends with
[attr*=value]
attribute value contains the substring
Grouping Selectors (A, B)
The , is a grouping method, it selects all the matching nodes.
Descendant combinator (A B)
The (space) combinator selects nodes that are descendants of the first element.
Child combinator (A > B)
The > combinator selects nodes that are direct children of the first element.
General sibling combinator (A ~ B)
The ~ combinator selects siblings. This means that the second element follows the first (though not necessarily immediately), and both share the same parent.
Adjacent sibling combinator (A + B)
The + combinator selects adjacent siblings. This means that the second element directly follows the first, and both share the same parent.

Pseudo-classes

A pseudo-class is used to define a special state of an element. The : pseudo allow the selection of elements based on state information that is not contained in the document tree.

:active
:checked
:default
:defined
:disabled
:empty
:enabled
:first
:first-child
:first-of-type
:focus
:focus-within
:host
:hover
:indeterminate
:in-range
:invadtd
:lang()
:last-child
:last-of-type
:left
:dtnk
:not()
:nth-child()
:nth-last-child()
:nth-last-of-type()
:nth-of-type()
:only-child
:only-of-type
:optional
:out-of-range
:read-only
:read-write
:required
:right
:root
:scope
:target
:vadtd
:visited

Pseudo-elements

A CSS pseudo-element is used to style specified parts of an element. The :: pseudo represent entities that are not included in HTML.

::after
::before
::cue
::cue-region
::first-letter
::first-line
::selection
::slotted()

Functions

attr()
Returns the value of an attribute of the selected element
calc()
Allows you to perform calculations to determine CSS property values
cubic-bezier()
Defines a Cubic Bezier curve
hsl()
Defines colors using the Hue-Saturation-Lightness model (HSL)
hsla()
Defines colors using the Hue-Saturation-Lightness-Alpha model (HSLA)
linear-gradient()
Sets a linear gradient as the background image. Define at least two colors (top to bottom)
radial-gradient()
Sets a radial gradient as the background image. Define at least two colors (center to edges)
repeating-linear-gradient()
Repeats a linear gradient
repeating-radial-gradient()
Repeats a radial gradient
rgb()
Defines colors using the Red-Green-Blue model (RGB)
rgba()
Defines colors using the Red-Green-Blue-Alpha model (RGBA)
var()
Inserts the value of a custom property

Units

cm
centimeters
mm
millimeters
in
inches (1in = 96px = 2.54cm)
px
pixels (1px = 1/96th of 1in) (pixels (px) are relative to the viewing device. For low-dpi devices, 1px is one device pixel (dot) of the display. For printers and high resolution screens 1px implies multiple device pixels)
pt
points (1pt = 1/72 of 1in)
pc
picas (1pc = 12 pt)
em
relative to the font-size of the element (2em means 2 times the size of the current font)
ex
relative to the x-height of the current font (rarely used)
ch
relative to width of the "0" (zero)
rem
relative to font-size of the root element
vw
relative to 1% of the width of the viewport*
vh
relative to 1% of the height of the viewport*
vmin
relative to 1% of viewport's* smaller dimension
vmax
relative to 1% of viewport's* larger dimension
%
Relative to the parent element

CSS Properties

align-content
Specifies the alignment between the lines inside a flexible container when the items do not use all available space
align-items
Specifies the alignment for items inside a flexible container
align-self
Specifies the alignment for selected items inside a flexible container
all
Resets all properties (except unicode-bidi and direction)
animation
A shorthand property for all the animation-* properties
animation-delay
Specifies a delay for the start of an animation
animation-direction
Specifies whether an animation should be played forwards, backwards or in alternate cycles
animation-duration
Specifies how long an animation should take to complete one cycle
animation-fill-mode
Specifies a style for the element when the animation is not playing (before it starts, after it ends, or both)
animation-iteration-count
Specifies the number of times an animation should be played
animation-name
Specifies a name for the @keyframes animation
animation-play-state
Specifies whether the animation is running or paused
animation-timing-function
Specifies the speed curve of an animation
backface-visibility
Defines whether or not the back face of an element should be visible when facing the user
background
A shorthand property for all the background-* properties
background-attachment
Sets whether a background image scrolls with the rest of the page, or is fixed
background-blend-mode
Specifies the blending mode of each background layer (color/image)
background-clip
Defines how far the background (color or image) should extend within an element
background-color
Specifies the background color of an element
background-image
Specifies one or more background images for an element
background-origin
Specifies the origin position of a background image
background-position
Specifies the position of a background image
background-repeat
Sets if/how a background image will be repeated
background-size
Specifies the size of the background images
border
A shorthand property for border-width, border-style and border-color
border-bottom
A shorthand property for border-bottom-width, border-bottom-style and border-bottom-color
border-bottom-color
Sets the color of the bottom border
border-bottom-left-radius
Defines the radius of the border of the bottom-left corner
border-bottom-right-radius
Defines the radius of the border of the bottom-right corner
border-bottom-style
Sets the style of the bottom border
border-bottom-width
Sets the width of the bottom border
border-collapse
Sets whether table borders should collapse into a single border or be separated
border-color
Sets the color of the four borders
border-image
A shorthand property for all the border-image-* properties
border-image-outset
Specifies the amount by which the border image area extends beyond the border box
border-image-repeat
Specifies whether the border image should be repeated, rounded or stretched
border-image-slice
Specifies how to slice the border image
border-image-source
Specifies the path to the image to be used as a border
border-image-width
Specifies the width of the border image
border-left
A shorthand property for all the border-left-* properties
border-left-color
Sets the color of the left border
border-left-style
Sets the style of the left border
border-left-width
Sets the width of the left border
border-radius
A shorthand property for the four border-*-radius properties
border-right
A shorthand property for all the border-right-* properties
border-right-color
Sets the color of the right border
border-right-style
Sets the style of the right border
border-right-width
Sets the width of the right border
border-spacing
Sets the distance between the borders of adjacent cells
border-style
Sets the style of the four borders
border-top
A shorthand property for border-top-width, border-top-style and border-top-color
border-top-color
Sets the color of the top border
border-top-left-radius
Defines the radius of the border of the top-left corner
border-top-right-radius
Defines the radius of the border of the top-right corner
border-top-style
Sets the style of the top border
border-top-width
Sets the width of the top border
border-width
Sets the width of the four borders
bottom
Sets the elements position, from the bottom of its parent element
box-decoration-break
Sets the behavior of the background and border of an element at page-break, or, for in-line elements, at line-break.
box-shadow
Attaches one or more shadows to an element
box-sizing
Defines how the width and height of an element are calculated: should they include padding and borders, or not
break-after
Specifies the page-, column-, or region-break behavior after the generated box
break-before
Specifies the page-, column-, or region-break behavior before the generated box
break-inside
Specifies the page-, column-, or region-break behavior inside the generated box
caption-side
Specifies the placement of a table caption
caret-color
Specifies the color of the cursor (caret) in inputs, textareas, or any element that is editable
@charset
Specifies the character encoding used in the style sheet
clear
Specifies on which sides of an element floating elements are not allowed to float
clip
Clips an absolutely positioned element
color
Sets the color of text
column-count
Specifies the number of columns an element should be divided into
column-fill
Specifies how to fill columns, balanced or not
column-gap
Specifies the gap between the columns
column-rule
A shorthand property for all the column-rule-* properties
column-rule-color
Specifies the color of the rule between columns
column-rule-style
Specifies the style of the rule between columns
column-rule-width
Specifies the width of the rule between columns
column-span
Specifies how many columns an element should span across
column-width
Specifies the column width
columns
A shorthand property for column-width and column-count
content
Used with the :before and :after pseudo-elements, to insert generated content
counter-increment
Increases or decreases the value of one or more CSS counters
counter-reset
Creates or resets one or more CSS counters
cursor
Specifies the mouse cursor to be displayed when pointing over an element
direction
Specifies the text direction/writing direction
display
Specifies how a certain HTML element should be displayed
empty-cells
Specifies whether or not to display borders and background on empty cells in a table
filter
Defines effects (e.g. blurring or color shifting) on an element before the element is displayed
flex
A shorthand property for the flex-grow, flex-shrink, and the flex-basis properties
flex-basis
Specifies the initial length of a flexible item
flex-direction
Specifies the direction of the flexible items
flex-flow
A shorthand property for the flex-direction and the flex-wrap properties
flex-grow
Specifies how much the item will grow relative to the rest
flex-shrink
Specifies how the item will shrink relative to the rest
flex-wrap
Specifies whether the flexible items should wrap or not
float
Specifies whether or not a box should float
font
A shorthand property for the font-style, font-variant, font-weight, font-size/line-height, and the font-family properties
@font-face
A rule that allows websites to download and use fonts other than the "web-safe" fonts
font-family
Specifies the font family for text
font-feature-settings
Allows control over advanced typographic features in OpenType fonts
@font-feature-values
Allows authors to use a common name in font-variant-alternate for feature activated differently in OpenType
font-kerning
Controls the usage of the kerning information (how letters are spaced)
font-language-override
Controls the usage of language-specific glyphs in a typeface
font-size
Specifies the font size of text
font-size-adjust
Preserves the readability of text when font fallback occurs
font-stretch
Selects a normal, condensed, or expanded face from a font family
font-style
Specifies the font style for text
font-synthesis
Controls which missing typefaces (bold or italic) may be synthesized by the browser
font-variant
Specifies whether or not a text should be displayed in a small-caps font
font-variant-alternates
Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values
font-variant-caps
Controls the usage of alternate glyphs for capital letters
font-variant-east-asian
Controls the usage of alternate glyphs for East Asian scripts (e.g Japanese and Chinese)
font-variant-ligatures
Controls which ligatures and contextual forms are used in textual content of the elements it applies to
font-variant-numeric
Controls the usage of alternate glyphs for numbers, fractions, and ordinal markers
font-variant-position
Controls the usage of alternate glyphs of smaller size positioned as superscript or subscript regarding the baseline of the font
font-weight
Specifies the weight of a font
grid
A shorthand property for the grid-template-rows, grid-template-columns, grid-template-areas, grid-auto-rows, grid-auto-columns, and the grid-auto-flow properties
grid-area
Either specifies a name for the grid item, or this property is a shorthand property for the grid-row-start, grid-column-start, grid-row-end, and grid-column-end properties
grid-auto-columns
Specifies a default column size
grid-auto-flow
Specifies how auto-placed items are inserted in the grid
grid-auto-rows
Specifies a default row size
grid-column
A shorthand property for the grid-column-start and the grid-column-end properties
grid-column-end
Specifies where to end the grid item
grid-column-gap
Specifies the size of the gap between columns
grid-column-start
Specifies where to start the grid item
grid-gap
A shorthand property for the grid-row-gap and grid-column-gap properties
grid-row
A shorthand property for the grid-row-start and the grid-row-end properties
grid-row-end
Specifies where to end the grid item
grid-row-gap
Specifies the size of the gap between rows
grid-row-start
Specifies where to start the grid item
grid-template
A shorthand property for the grid-template-rows, grid-template-columns and grid-areas properties
grid-template-areas
Specifies how to display columns and rows, using named grid items
grid-template-columns
Specifies the size of the columns, and how many columns in a grid layout
grid-template-rows
Specifies the size of the rows in a grid layout
hanging-punctuation
Specifies whether a punctuation character may be placed outside the line box
height
Sets the height of an element
hyphens
Sets how to split words to improve the layout of paragraphs
image-rendering
Gives a hint to the browser about what aspects of an image are most important to preserve when the image is scaled
@import
Allows you to import a style sheet into another style sheet
isolation
Defines whether an element must create a new stacking content
justify-content
Specifies the alignment between the items inside a flexible container when the items do not use all available space
@keyframes
Specifies the animation code
left
Specifies the left position of a positioned element
letter-spacing
Increases or decreases the space between characters in a text
line-break
Specifies how/if to break lines
line-height
Sets the line height
list-style
Sets all the properties for a list in one declaration
list-style-image
Specifies an image as the list-item marker
list-style-position
Specifies the position of the list-item markers (bullet points)
list-style-type
Specifies the type of list-item marker
margin
Sets all the margin properties in one declaration
margin-bottom
Sets the bottom margin of an element
margin-left
Sets the left margin of an element
margin-right
Sets the right margin of an element
margin-top
Sets the top margin of an element
max-height
Sets the maximum height of an element
max-width
Sets the maximum width of an element
@media
Sets the style rules for different media types/devices/sizes
min-height
Sets the minimum height of an element
min-width
Sets the minimum width of an element
mix-blend-mode
Specifies how an element's content should blend with its direct parent background
object-fit
Specifies how the contents of a replaced element should be fitted to the box established by its used height and width
object-position
Specifies the alignment of the replaced element inside its box
opacity
Sets the opacity level for an element
order
Sets the order of the flexible item, relative to the rest
orphans
Sets the minimum number of lines that must be left at the bottom of a page when a page break occurs inside an element
outline
A shorthand property for the outline-width, outline-style, and the outline-color properties
outline-color
Sets the color of an outline
outline-offset
Offsets an outline, and draws it beyond the border edge
outline-style
Sets the style of an outline
outline-width
Sets the width of an outline
overflow
Specifies what happens if content overflows an element's box
overflow-wrap
Specifies whether or not the browser may break lines within words in order to prevent overflow (when a string is too long to fit its containing box)
overflow-x
Specifies whether or not to clip the left/right edges of the content, if it overflows the element's content area
overflow-y
Specifies whether or not to clip the top/bottom edges of the content, if it overflows the element's content area
padding
A shorthand property for all the padding-* properties
padding-bottom
Sets the bottom padding of an element
padding-left
Sets the left padding of an element
padding-right
Sets the right padding of an element
padding-top
Sets the top padding of an element
page-break-after
Sets the page-break behavior after an element
page-break-before
Sets the page-break behavior before an element
page-break-inside
Sets the page-break behavior inside an element
perspective
Gives a 3D-positioned element some perspective
perspective-origin
Defines at which position the user is looking at the 3D-positioned element
pointer-events
Defines whether or not an element reacts to pointer events
position
Specifies the type of positioning method used for an element (static, relative, absolute or fixed)
quotes
Sets the type of quotation marks for embedded quotations
resize
Defines if (and how) an element is resizable by the user
right
Specifies the right position of a positioned element
scroll-behavior
Specifies whether to smoothly animate the scroll position in a scrollable box, instead of a straight jump
tab-size
Specifies the width of a tab character
table-layout
Defines the algorithm used to lay out table cells, rows, and columns
text-align
Specifies the horizontal alignment of text
text-align-last
Describes how the last line of a block or a line right before a forced line break is aligned when text-align is "justify"
text-combine-upright
Specifies the combination of multiple characters into the space of a single character
text-decoration
Specifies the decoration added to text
text-decoration-color
Specifies the color of the text-decoration
text-decoration-line
Specifies the type of line in a text-decoration
text-decoration-style
Specifies the style of the line in a text decoration
text-indent
Specifies the indentation of the first line in a text-block
text-justify
Specifies the justification method used when text-align is "justify"
text-orientation
Defines the orientation of the text in a line
text-overflow
Specifies what should happen when text overflows the containing element
text-shadow
Adds shadow to text
text-transform
Controls the capitalization of text
text-underline-position
Specifies the position of the underline which is set using the text-decoration property
top
Specifies the top position of a positioned element
transform
Applies a 2D or 3D transformation to an element
transform-origin
Allows you to change the position on transformed elements
transform-style
Specifies how nested elements are rendered in 3D space
transition
A shorthand property for all the transition-* properties
transition-delay
Specifies when the transition effect will start
transition-duration
Specifies how many seconds or milliseconds a transition effect takes to complete
transition-property
Specifies the name of the CSS property the transition effect is for
transition-timing-function
Specifies the speed curve of the transition effect
unicode-bidi
Used together with the direction property to set or return whether the text should be overridden to support multiple languages in the same document
user-select
Specifies whether the text of an element can be selected
vertical-align
Sets the vertical alignment of an element
visibility
Specifies whether or not an element is visible
white-space
Specifies how white-space inside an element is handled
widows
Sets the minimum number of lines that must be left at the top of a page when a page break occurs inside an element
width
Sets the width of an element
word-break
Specifies how words should break when reaching the end of a line
word-spacing
Increases or decreases the space between words in a text
word-wrap
Allows long, unbreakable words to be broken and wrap to the next line
writing-mode
Specifies whether lines of text are laid out horizontally or vertically
z-index
Sets the stack order of a positioned element

DOM

Node Properties

attributes
Returns a live collection of all attributes registered to an element
baseURI
Provides the absolute base URL of an HTML element
childNodes
Gives a collection of an element’s child nodes
firstChild
Returns the first child node of an element
lastChild
The last child node of an element
nextSibling
Gives you the next node at the same node tree level
nodeName
eturns the name of a node
nodeType
Returns the type of a node
nodeValue
Sets or returns the value of a node
ownerDocument
The top-level document object for this node
parentNode
Returns the parent node of an element
previousSibling
Returns the node immediately preceding the current one
textContent
Sets or returns the textual content of a node and its descendants

Node Methods

appendChild()
Adds a new child node to an element as the last child node
cloneNode()
Clones an HTML element
compareDocumentPosition()
Compares the document position of two elements
getFeature()
Returns an object which implements the APIs of a specified feature
hasAttributes()
Returns true if an element has any attributes, otherwise false
hasChildNodes()
Returns true if an element has any child nodes, otherwise false
insertBefore()
Inserts a new child node before a specified, existing child node
isDefaultNamespace()
Returns true if a specified namespaceURI is the default, otherwise false
isEqualNode()
Checks if two elements are equal
isSameNode()
Checks if two elements are the same node
isSupported()
Returns true if a specified feature is supported on the element
lookupNamespaceURI()
Returns the namespace URI associated with a given node
lookupPrefix()
Returns a DOMString containing the prefix for a given namespace URI if present
normalize()
Joins adjacent text nodes and removes empty text nodes in an element
removeChild()
Removes a child node from an element
replaceChild()
Replaces a child node in an element

Element Methods

getAttribute()
Returns the specified attribute value of an element node
getAttributeNS()
Returns string value of the attribute with the specified namespace and name
getAttributeNode()
Gets the specified attribute node
getAttributeNodeNS()
Returns the attribute node for the attribute with the given namespace and name
getElementsByTagName()
Provides a collection of all child elements with the specified tag name
getElementsByTagNameNS()
Returns a live HTMLCollection of elements with a certain tag name belonging to the given namespace
hasAttribute()
Returns true if an element has any attributes, otherwise false
hasAttributeNS()
Provides a true/false value indicating whether the current element in a given namespace has
the specified
tribute
removeAttribute()
Removes a specified attribute from an element
removeAttributeNS()
Removes the specified attribute from an element within a certain namespace
removeAttributeNode()
Takes away a specified attribute node and returns the removed node
setAttribute()
Sets or changes the specified attribute to a specified value
setAttributeNS()
Adds a new attribute or changes the value of an attribute with the given namespace and name
setAttributeNode()
Sets or changes the specified attribute node
setAttributeNodeNS()
Adds a new namespaced attribute node to an element

Window Properties

closed
Checks whether a window has been closed or not and returns true or false
defaultStatus
Sets or returns the default text in the status bar of a window
document
Returns the document object for the window
frames
Returns all <iframe> elements in the current window
history
Provides the History object for the window
innerHeight
The inner height of a window’s content area
innerWidth
The inner width of the content area
length
Find out the number of <iframe> elements in the window
location
Returns the location object for the window
name
Sets or returns the name of a window
navigator
Returns the Navigator object for the window
opener
Returns a reference to the window that created the window
outerHeight
The outer height of a window, including toolbars/scrollbars
outerWidth
The outer width of a window, including toolbars/scrollbars
pageXOffset
Number of pixels the current document has been scrolled horizontally
pageYOffset
Number of pixels the document has been scrolled vertically
parent
The parent window of the current window
screen
Returns the Screen object for the window
screenLeft
The horizontal coordinate of the window (relative to the screen)
screenTop
The vertical coordinate of the window
screenX
Same as screenLeft but needed for some browsers
screenY
Same as screenTop but needed for some browsers
self
Returns the current window
status
Sets or returns the text in the status bar of a window
top
Returns the topmost browser window

Window Methods

alert()
Displays an alert box with a message and an OK button
blur()
Removes focus from the current window
clearInterval()
Clears a timer set with setInterval()
clearTimeout()
Clears a timer set with setTimeout()
close()
Closes the current window
confirm()
Displays a dialogue box with a message and an OK and Cancel button
focus()
Sets focus to the current window
moveBy()
Moves a window relative to its current position
moveTo()
Moves a window to a specified position
open()
Opens a new browser window
print()
Prints the content of the current window
prompt()
Displays a dialogue box that prompts the visitor for input
resizeBy()
Resizes the window by the specified number of pixels
resizeTo()
Resizes the window to a specified width and height
scrollBy()
Scrolls the document by a specified number of pixels
scrollTo()
Scrolls the document to specified coordinates
setInterval()
Calls a function or evaluates an expression at specified intervals
setTimeout()
Calls a function or evaluates an expression after a specified interval
stop()
Stops the window from loading

Screen Properties

availHeight
Returns the height of the screen (excluding the Windows Taskbar)
availWidth
Returns the width of the screen (excluding the Windows Taskbar)
colorDepth
Returns the bit depth of the color palette for displaying images
height
The total height of the screen
pixelDepth
The color resolution of the screen in bits per pixel
width
The total width of the screen

Mouse Events

onclick
The event occurs when the user clicks on an element
oncontextmenu
User right-clicks on an element to open a context menu
ondblclick
The user double-clicks on an element
onmousedown
User presses a mouse button over an element
onmouseenter
The pointer moves onto an element
onmouseleave
Pointer moves out of an element
onmousemove
The pointer is moving while it is over an element
onmouseover
When the pointer is moved onto an element or one of its children
onmouseout
User moves the mouse pointer out of an element or one of its children
onmouseup
The user releases a mouse button while over an element

Keyboard Events

onkeydown
When the user is pressing a key down
onkeypress
The moment the user starts pressing a key
onkeyup
The user releases a key

Frame Events

onabort
The loading of a media is aborted
onbeforeunload
Event occurs before the document is about to be unloaded
onerror
An error occurs while loading an external file
onhashchange
There have been changes to the anchor part of a URL
onload
When an object has loaded
onpagehide
The user navigates away from a webpage
onpageshow
When the user navigates to a webpage
onresize
The document view is resized
onscroll
An element’s scrollbar is being scrolled
onunload
Event occurs when a page has unloaded

Form Events

onblur
When an element loses focus
onchange
The content of a form element changes (for <input>, <select> and <textarea>)
onfocus
An element gets focus
onfocusin
When an element is about to get focus
onfocusout
The element is about to lose focus
oninput
User input on an element
oninvalid
An element is invalid
onreset
A form is reset
onsearch
The user writes something in a search field (for <input="search">)
onselect
The user selects some text (for <input> and <textarea>)
onsubmit
A form is submitted

Drag Events

ondrag
An element is dragged
ondragend
The user has finished dragging the element
ondragenter
The dragged element enters a drop target
ondragleave
A dragged element leaves the drop target
ondragover
The dragged element is on top of the drop target
ondragstart
User starts to drag an element
ondrop
Dragged element is dropped on the drop target

Clipboard Events

oncopy
User copies the content of an element
oncut
The user cuts an element’s content
onpaste
A user pastes the content in an element

Media Events

onabort
Media loading is aborted
oncanplay
The browser can start playing media (e.g. a file has buffered enough)
oncanplaythrough
The browser can play through media without stopping
ondurationchange
The duration of the media changes
onended
The media has reached its end
onerror
Happens when an error occurs while loading an external file
onloadeddata
Media data is loaded
onloadedmetadata
Metadata (like dimensions and duration) are loaded
onloadstart
The browser starts looking for specified media
onpause
Media is paused either by the user or automatically
onplay
The media has been started or is no longer paused
onplaying
Media is playing after having been paused or stopped for buffering
onprogress
The browser is in the process of downloading the media
onratechange
The playing speed of the media changes
onseeked
User is finished moving/skipping to a new position in the media
onseeking
The user starts moving/skipping
onstalled
The browser is trying to load the media but it is not available
onsuspend
The browser is intentionally not loading media
ontimeupdate
The playing position has changed (e.g. because of fast forward)
onvolumechange
Media volume has changed (including mute)
onwaiting
Media paused but expected to resume (for example, buffering)

Animation Events

animationend
A CSS animation is complete
animationiteration
CSS animation is repeated
animationstart
CSS animation has started

Other Events

transitionend
Fired when a CSS transition has completed
onmessage
A message is received through the event source
onoffline
The browser starts to work offline
ononline
The browser starts to work online
onpopstate
When the window’s history changes
onshow
A <menu> element is shown as a context menu
onstorage
A Web Storage area is updated
ontoggle
The user opens or closes the <details> element
onwheel
Mouse wheel rolls up or down over an element
ontouchcancel
Screen-touch is interrupted
ontouchend
User’s finger is removed from a touch-screen
ontouchmove
A finger is dragged across the screen
ontouchstart
A finger is placed on the touch-screen

Node.js

Built-in Modules

assert
Provides a set of assertion tests
buffer
To handle binary data
child_process
To run a child process
cluster
To split a single Node process into multiple processes
crypto
To handle OpenSSL cryptographic functions
dgram
Provides implementation of UDP datagram sockets
dns
To do DNS lookups and name resolution functions
events
To handle events
fs
To handle the file system
http
To make Node.js act as an HTTP server
https
To make Node.js act as an HTTPS server.
net
To create servers and clients
os
Provides information about the operation system
path
To handle file paths
querystring
To handle URL query strings
readline
To handle readable streams one line at the time
stream
To handle streaming data
string_decoder
To decode buffer objects into strings
timers
To execute a function after a given number of milliseconds
tls
To implement TLS and SSL protocols
tty
Provides classes used by a text terminal
url
To parse URL strings
util
To access utility functions
v8
To access information about V8 (the JavaScript engine)
vm
To compile JavaScript code in a virtual machine
zlib
To compress or decompress files

Assert Module

assert()
Checks if a value is true. Same as assert.ok()
deepEqual()
Checks if two values are equal
deepStrictEqual()
Checks if two values are equal, using the strict equal operator (===)
equal()
Checks if two values are equal, using the equal operator (==)
fail()
Throws an Assertion Error
ifError()
Throws a specified error if the specified error evaluates to true
notDeepEqual()
Checks if two values are not equal
notDeepStrictEqual()
Checks if two values are not equal, using the strict not equal operator (!==)
notEqual()
Checks if two values are not equal, using the not equal operator (!=)
notStrictEqual()
Checks if two values are not equal, using the strict not equal operator (!==)
ok()
Checks if a value is true
strictEqual()
Checks if two values are equal, using the strict equal operator (===)

Buffer Module

alloc()
Creates a Buffer object of the specified length
allocUnsafe()
Creates a non-zero-filled Buffer of the specified length
allocUnsafeSlow
Cr
eates a non-zero-filled and non-pooled Buffer of the specified length
byteLength()
Returns the numbers of bytes in a specified object
compare()
Compares two Buffer objects
concat()
Concatenates an array of Buffer objects into one Buffer object
copy()
Copies the specified number of bytes of a Buffer object
entries()
Returns an iterator of "index" "byte" pairs of a Buffer object
equals()
Compares two Buffer objects, and returns true if it is a match, otherwise false
fill()
Fills a Buffer object with the specified values
from()
Creates a Buffer object from an object (string/array/buffer)
includes()
Checks if the Buffer object contains the specified value. Returns true if there is a match, otherwise false
indexOf()
Checks if the Buffer object contains the specified value. Returns the first occurrence, otherwise -1
isBuffer()
Checks if an object is a Buffer object
isEncoding()
Checks if the Buffer object supports the specified encoding
keys()
Returns an array of keys in a Buffer object
lastIndexOf()
Checks if the Buffer object contains the specified value. Returns the first occurrence, starting from the end, otherwise -1
length
Re
turns the length of a Buffer object, in bytes
poolSize
Se
ts or returns the number of bytes used for pooling
readDoubleBE()
Reads a 64 bit double from a Buffer object, returns the result in big endian
readDoubleLE()
Reads a 64 bit double from a Buffer object, returns the result in little endian
readFloatBE()
Reads a 32 bit float from a Buffer object, returns the result in big endian
readFloatLE()
Reads a 32 bit float from a Buffer object, returns the result in little endian
readInt8()
Reads a 8 bit integer from a Buffer object
readInt16BE()
Reads a 16 bit integer from a Buffer object, returns the result in big endian
readInt16LE()
Reads a 16 bit integer from a Buffer object, returns the result in little endian
readInt32BE()
Reads a 32 bit integer from a Buffer object, returns the result in big endian
readInt32LE()
Reads a 32 bit integer from a Buffer object, returns the result in little endian
readIntBE()
Reads the specified number of bytes from a Buffer object, returns the result in big endian
readIntLE()
Reads the specified number of bytes from a Buffer object, returns the result in little endian
readUInt8()
Reads an unsigned 8 bit integer from a Buffer object
readUInt16BE()
Reads an unsigned 16 bit integer from a Buffer object, returns the result in big endian
readUInt16LE()
Reads an unsigned 16 bit integer from a Buffer object, returns the result in little endian
readUInt32BE()
Reads an unsigned 32 bit integer from a Buffer object, returns the result in big endian
readUInt32LE()
Reads an unsigned 32 bit integer from a Buffer object, returns the result in little endian
readUintBE()
Reads the specified number of bytes from a Buffer object, returns the result as an unsigned integer
readUIntLE()
Reads the specified number of bytes from a Buffer object, returns the result as an unsigned integer
slice()
Slices a Buffer object into a new Buffer objects starting and ending at the specified positions
swap16()
Swaps the byte-order of a 16 bit Buffer object
swap32()
Swaps the byte-order of a 32 bit Buffer object
swap64()
Swaps the byte-order of a 64 bit Buffer object
toString()
Returns a string version of a Buffer object
toJSON()
Returns a JSON version of a Buffer object
values()
Returns an array of values in a Buffer object
write()
Writes a specified string to a Buffer object
writeDoubleBE()
Writes the specified bytes, using big endian, to a Buffer object. The bytes should be 64 bit double.
writeDoubleLE()
Writes the specified bytes, using little endian, to a Buffer object. The bytes should be 64 bit double.
writeFloatBE()
Writes the specified bytes, using big endian, to a Buffer object. The bytes should be 32 bit float.
writeFloatLE()
Writes the specified bytes, using little endian, to a Buffer object. The bytes should be 32 bit float.
writeInt8()
Writes the specified bytes to a Buffer object. The bytes should be 8 bit integer
writeInt16BE()
Writes the specified bytes, using big endian, to a Buffer object. The bytes should be 16 bit integer.
writeInt16LE()
Writes the specified bytes, using little endian, to a Buffer object. The bytes should be 16 bit integer.
writeInt32BE()
Writes the specified bytes, using big endian, to a Buffer object. The bytes should be 32 bit integer.
writeInt32LE()
Writes the specified bytes, using little endian, to a Buffer object. The bytes should be 32 bit integer.
writeIntBE()
Writes the specified bytes, using big endian, to a Buffer object.
writeIntLE()
Writes the specified bytes, using little endian, to a Buffer object.
writeUInt8()
Writes the specified bytes to a Buffer object. The bytes should be 8 bit unsigned integer
writeUInt16BE()
Writes the specified bytes, using big endian, to a Buffer object. The bytes should be 16 bit unsigned integer.
writeUInt16LE()
Writes the specified bytes, using little endian, to a Buffer object. The bytes should be 16 bit unsigned integer.
writeUInt32BE()
Writes the specified bytes, using big endian, to a Buffer object. The bytes should be 32 bit unsigned integer.
writeUInt32LE()
Writes the specified bytes, using little endian, to a Buffer object. The bytes should be 32 bit unsigned integer.
writeUIntBE()
Writes the specified bytes, using big endian, to a Buffer object
writeUIntLE()
Writes the specified bytes, using little endian, to a Buffer object

Cluster Module

disconnect()
Disconnects all workers
exitedAfterDisconnect
Returns true if a worker was exited after disconnect, or the kill method
fork()
Creates a new worker, from a master
id
A unique id for a worker
isConnected
Returns true if the worker is connected to its master, otherwise false
isDead
Returns true if the worker's process is dead, otherwise false
isMaster
Returns true if the current process is master, otherwise false
isWorker
Returns true if the current process is worker, otherwise false
kill()
Kills the current worker
process
Returns the global Child Process
schedulingPolicy
Sets or gets the schedulingPolicy
send()
sends a message to a master or a worker
settings
Returns an object containing the cluster's settings
setupMaster()
Changes the settings of a cluster
worker
Returns the current worker object
workers
Returns all workers of a master

Crypto Module

constants
Returns an object containing Crypto Constants
fips
Checks if a FIPS crypto provider is in use
createCipher()
Creates a Cipher object using the specific algorithm and password
createCipheriv()
Creates a Cipher object using the specific algorithm, password and initialization vector
createDecipher()
Creates a Decipher object using the specific algorithm and password
createDecipheriv()
Creates a Decipher object using the specific algorithm, password and initialization vector
createDiffieHellman()
Creates a DiffieHellman key exchange object
createECDH()
Creates an Elliptic Curve Diffie Hellmann key exchange object
createHash()
Creates a Hash object using the specified algorithm
createHmac()
Creates a Hmac object using the specified algorithm and key
createSign()
Creates a Sign object using the specified algorithm and key
createVerify()
Creates a Verify object using the specified algorithm
getCiphers
Returns an array of supported cipher algorithms
getCurves()
Returns an array of supported elliptic curves
getDiffieHellman()
Returns a predefined Diffie Hellman key exchange object
getHashes()
Returns an array of supported hash algorithms
pbkdf2()
Creates a Password Based Key Derivation Function 2 implementation
pbkdf2Sync()
Creates a synchronous Password Based Key Derivation Function 2 implementation
privateDecrypt()
Decrypts data using a private key
timingSafeEqual()
Compare two Buffers and returns true is they are equal, otherwise false
privateEncrypt()
Encrypts data using a private key
publicDecrypt()
Decrypts data using a public key
publicEncrypt()
Encrypts data using a public key
randomBytes()
Creates random data
setEngine()
Sets the engine for some or all OpenSSL function

Datagram Module (dgram)

createSocket()
Creates a Socket object

DNS Module

getServers()
Returns an array containing all IP addresses belonging to the current server
lookup()
Looks up a hostname. A callback function contains information about the hostname, including it's IP address
lookupService()
Looks up a address and port. A callback function contains information about the address, such as the hostname
resolve()
Returns an array of record types belonging to the specified hostname
resolve4()
Looks up an IPv4 address. The callback function includes an array of IPv4 addresses
resolve6()
Looks up an IPv6 address. The callback function includes an array of IPv6 addresses
resolveCname()
Looks up CNAME records for the specified hostname. The callback function includes an array of available domains for the hostname
resolveMx()
Looks up mail exchange records for the specified hostname.
resolveNaptr()
Looks up regular expression based records for the specified hostname.
resolveNs()
Looks up name server records for the specified hostname.
resolveSoa()
Looks up a start of authority record for the specified hostname.
resolveSrv()
Looks up service records for the specified hostname.
resolvePtr()
Looks up pointer records for the specified hostname.
resolveTxt()
Looks up text query records for the specified hostname.
reverse()
Reverses an IP address into an array of hostnames
setServers()
Sets the IP addresses of the servers

Events Module

addListener()
Adds the specified listener
defaultMaxListeners
Sets the maximum number of listeners allowed for one event. Default is 10
emit()
Call all the listeners registered with the specified name
eventNames()
Returns an array containing all registered events
getMaxListeners()
Returns the maximum number of listeners allowed for one event
listenerCount()
Returns the number of listeners with the specified name
listeners()
Returns an array of listeners with the specified name
on()
Adds the specified listener
once()
Adds the specified listener once. When the specified listener has been executed, the listener is removed
prependListener()
Adds the specified listener as the first event with the specified name
prependOnceListener()
Adds the specified listener as the first event with the specified name, once. When the specified listener has been executed, the listener is removed
removeAllListeners()
Removes all listeners with the specified name, or ALL listeners if no name is specified
removeListener()
Removes the specified listener with the specified name
setMaxListeners()
Sets the maximum number of listeners allowed for one event. Default is 10

File System Module (fs)

access()
Checks if a user has access to this file or directory
accessSync()
Same as access(), but synchronous instead of asynchronous
appendFile()
Appends data to a file
appendFileSync()
Same as appendFile(), but synchronous instead of asynchronous
chmod()
Changes the mode of a file
chmodSync()
Same as chmod(), but synchronous instead of asynchronous
chown()
Changes the owner of a file
chownSync()
Same as chown(), but synchronous instead of asynchronous
close()
Closes a file
closeSync()
Same as close(), but synchronous instead of asynchronous
constants Returns
a
n object containing constant values for the file system
createReadStream()
Returns a new stream object
createWriteStream()
Returns a new writeable stream object
exists()
Deprecated. Checks if a file or folder exists
existsSync()
Same as exists(), but synchronous instead of asynchronous. This method is NOT deprecated
fchmod()
Changes the mode of a file
fchmodSync()
Same as fchmod(), but synchronous instead of asynchronous
fchown()
Changes the owner of a file
fchownSync()
Same as fchown(), but synchronous instead of asynchronous
fdatasync()
Syncronizes a file with the one stored on the computer
fdatasyncSync()
Same as fdatasync(), but synchronous instead of asynchronous
fstat()
Returns the status of a file
fstatSync()
Same as fstat(), but synchronous instead of asynchronous
fsync()
Syncronizes a file with the one stored on the computer
fsyncSync()
Same as fsync(), but synchronous instead of asynchronous
ftruncated()
Truncates a file
ftruncatedSync()
Same as ftruncated(), but synchronous instead of asynchronous
futimes()
Change the timestamp of a file
futimesSync()
Same as futimes(), but synchronous instead of asynchronous
lchmod()
Changes the mode of a file, for Mac OS X
lchmodSync()
Same as lchmod(), but synchronous instead of asynchronous
lchown()
Changes the owner of a file, for Mac OS X
lchownSync()
Same as lchown(), but synchronous instead of asynchronous
link()
Makes an addition name for a file. Both the old and the new name may be used
linksync()
Same as link(), but synchronous instead of asynchronous
lstat()
Returns the status of a file
lstatSync()
Same as lstat(), but synchronous instead of asynchronous
mkdir()
Makes a new directory
mkdirSync()
Same as mkdir(), but synchronous instead of asynchronous
mkdtemp()
Makes a new temporary directory
mkdtempSync()
Same as mktemp(), but synchronous instead of asynchronous
open()
Opens a file
openSync()
Same as open(), but synchronous instead of asynchronous
read()
Reads the content of a file
readdir()
Reads the content of a directory
readdirSync()
Same as readdir(), but synchronous instead of asynchronous
readFile()
Reads the content of a file
readFileSync()
Same as readFile(), but synchronous instead of asynchronous
readlink()
Reads the value of a link
readlinkSync()
Same as readlink(), but synchronous instead of asynchronous
realpath()
Returns the absolute pathname
realpathSync()
Same as realpath(), but synchronous instead of asynchronous
rename()
Renames a file
renameSync()
Same as rename(), but synchronous instead of asynchronous
rmdir()
Removes a directory
rmdirSync()
Same as rmdir(), but synchronous instead of asynchronous
stat()
Returns the status of a file
statSync()
Same as stat(), but synchronous instead of asynchronous
symlink()
Makes a symbolic name for a file
symlinkSync()
Same as symlink(), but synchronous instead of asynchronous
truncate()
Truncates a file
truncateSync()
Same as truncate(), but synchronous instead of asynchronous
unlink()
Removes a link
unlinkSync()
Same as unlink(), but synchronous instead of asynchronous
unwatchFile()
Stops watching for changes on a filename
utimes()
Change the timestamp of a file
utimesSync()
Same as utimes(), but synchronous instead of asynchronous
watch()
Watch for changes of a filename or directoryname
watchFile()
Watch for changes of a filename
write()
Writes buffer to a file
write()
Writes data to a file
writeFile()
Writes data to a file
writeFileSync()
Same as writeFile(), but synchronous instead of asynchronous
writeSync()
Same as write(); writes buffer to a file synchronous instead of asynchronous

HTTP Module

createClient()
Deprecated. Creates a HTTP client
createServer()
Creates an HTTP server
get()
Sets the method to GET, and returns an object containing the user's request
globalAgent
Returns the HTTP Agent
request()
Returns an object containing the user's request

HTTPS Module

createServer()
Creates an HTTPS server
get()
Sets the method to GET, and returns an object containing the user's request
globalAgent
Returns the HTTPS Agent
request
Makes a request to a secure web server

Net Module

connect()
Creates a new connection to the server, and returns a new Socket
createConnection()
Creates a new connection to the server, and returns a new Socket
createServer()
Creates a new server
isIP
Checks if the specified value is an IP address
isIPv4
Checks if the specified value is an IPv4 address
isIPv6
Checks if the specified value is an IPv6 address

OS Module

arch()
Returns the operating system CPU architecture
constants
Returns an object containing the operating system's constants for process signals, error cotes etc.
cpus()
Returns an array containing information about the computer's CPUs
endiannes()
Returns the endianness of the CPU
EOL
Returns the end-of-line marker for the current operating system
freemem()
Returns the number of free memory of the system
hostname()
Returns the hostname of the operating system
loadavg()
Returns an array containing the load averages, (1, 5, and 15 minutes)
networkInterfaces()
Returns the network interfaces that has a network address
platform()
Returns information about the operating system's platform
release()
Returns information about the operating system's release
tmpdir()
Returns the operating system's default directory for temporary files
totalmem()
Returns the number of total memory of the system
type()
Returns the name of the operating system
uptime()
Returns the uptime of the operating system, in seconds
userInfo()
Returns information about the current user

Path Module

basename()
Returns the last part of a path
delimiter
Returns the delimiter specified for the platform
dirname()
Returns the directories of a path
extname()
Returns the file extension of a path
format()
Formats a path object into a path string
isAbsolute()
Returns true if a path is an absolute path, otherwise false
join()
Joins the specified paths into one
normalize()
Normalizes the specified path
parse()
Formats a path string into a path object
posix
Returns an object containing POSIX specific properties and methods
relative()
Returns the relative path from one specified path to another specified path
resolve()
Resolves the specified paths into an absolute path
sep
Returns the segment separator specified for the platform
win32
Returns an object containing Windows specific properties and methods

Query String Module (querystring)

escape()
Returns an escaped querystring
parse()
Parses the querystring and returns an object
stringify()
Stringifies an object, and returns a query string
unescape()
Returns an unescaped query string

Readline Module

clearLine()
Clears the current line of the specified stream
clearScreenDown()
Clears the specified stream from the current cursor down position
createInterface()
Creates an Interface object
cursorTo()
Moves the cursor to the specified position
emitKeypressEvents()
Fires keypress events for the specified stream
moveCursor()
Moves the cursor to a new position, relative to the current position

Stream Module

isPaused()
Returns true if the state of the readable stream is paused, otherwise false
pause()
Pauses the readable stream
pipe()
Turns the readable stream into the specified writable stream
read()
Returns a specified part of the readable stream
resume()
Resumes a paused stream
setEncoding()
Sets the character encoding of the readable stream
unpipe()
Stops turning a readable stream into a writable stream, caused by the pipe() method
unshift()
Pushes some specified data back into the internal buffer
wrap()
Helps reading streams made by older Node.js versions

String Decoder Module (string_decoder)

end()
Returns what remains of the input stored in the internal buffer
write()
Returns the specified buffer as a string

Timers Module

clearImmediate()
Cancels an Immediate object
clearInterval()
Cancels an Interval object
clearTimeout()
Cancels a Timeout object
ref()
Makes the Timeout object active. Will only have an effect if the Timeout.unref() method has been called to make the Timeout object inactive.
setImmediate()
Executes a given function immediately.
setInterval()
Executes a given function at every given milliseconds
setTimeout()
Executes a given function after a given time (in milliseconds)
unref()
Stops the Timeout object from remaining active.

TLS Module

connect()
Returns a Socket object
createSecureContext()
Creates an object containing security details
createServer()
Creates a Server object
getCiphers()
Returns an array containing the supported SSL ciphers

URL Module

url.format()
Returns a formatted URL string
url.parse()
Returns a URL object
url.resolve()
Resolves a URL

Util Module

debuglog()
Writes debug messages to the error object
deprecate()
Marks the specified function as deprecated
format()
Formats the specified string, using the specified arguments
inherits()
Inherits methods from one function into another
inspect()
Inspects the specified object and returns the object as a string

VM Module

createContext()
Prepares a virtual machine, or sandbox, where you can execute scripts
isContext()
Returns true if the specified sandbox has been created by the createContext() method
runInContext()
Executes JavaScript code in the specified context, and returns the result
runInDebug()
Executes JavaScript inside the debug context
runInNewContext()
Executes JavaScript code in a new context, and returns the result
runInThisContext()
Executes JavaScript code in the global context, and returns the result

Zlib Module

constants
Returns an object containing Zlib constants
createDeflate()
Creates a Deflate object
createDeflateRaw()
Creates a DeflateRaw object
createGunzip()
Creates a Gunzip object
createGzip()
Creates a Gzip object
createInflate()
Creates a Inflate object
createInflateRaw()
Creates a InflateRaw object
createUnzip()
Creates a Unzip object
deflate()
Compress a string or buffer, using Deflate
deflateSync()
Compress a string or buffer, syncronously, using Deflate
deflateRaw()
Compress a string or buffer, using DeflateRaw
deflateRawSync()
Compress a string or buffer, syncronously, using DeflateRaw
gunzip()
Compress a string or buffer, using Gunzip
gunzipSync()
Compress a string or buffer, syncronously, using Gunzip
gzip()
Compress a string or buffer, using Gzip
gzipSync()
Compress a string or buffer, syncronously, using Gzip
inflate()
Decompress a string or buffer, using Inflate
inflateSync()
Decompress a string or buffer, syncronously, using Inflate
inflateRaw()
Decompress a string or buffer, using InflateRaw
inflateRawSync()
Decompress a string or buffer, syncronously, using InflateRaw
unzip()
Decompress a string or buffer, using Unzip
unzipSync()
Decompress a string or buffer, syncronously, using Unzip

Other

Acronyms

JSON
JavaScript Object Notation
REST
REpresentational State Transfer
IIFE
Immediate-Invoked Function Expression

HTTP Status Codes

1xx: Informational
Communicates transfer protocol-level information.
2xx: Success
Indicates that the client’s request was accepted successfully.
3xx: Redirection
Indicates that the client must take some additional action in order to complete their request.
4xx: Client Error
This category of error status codes points the finger at clients.
5xx: Server Error
The server takes responsibility for these error status codes.