ES Features - NeverGiveUp143/JS GitHub Wiki

ES6 (ES2015)

let and const: Block-scoped variable declarations.

Arrow functions: Shorter syntax for function expressions.

Default parameters: Allow named parameters to be initialized with default values.

Rest and spread operators: Simplify working with arrays and function arguments.

Template literals: Enhanced string literals for easier multi-line strings and string interpolation.

Destructuring assignment: Unpacking values from arrays or properties from objects into distinct variables.

Classes and inheritance: Syntactical sugar over JavaScript's existing prototype-based inheritance.

Promises: Simplified asynchronous programming.

Symbols: Unique and immutable data types for object keys.

Iterators and generators: New ways to work with iterable objects.

Sets and Maps: New data structures for collections.

ES7 (ES2016)

Array.prototype.includes(): Checks if an array contains a certain value.

Exponentiation operator: for raising numbers to a power.

ES8 (ES2017)

async/await: Simplifies working with promises.

Object.entries(): Returns an array of a given object's own enumerable string-keyed property [key, value] pairs.

Object.values(): Returns an array of a given object's own enumerable string-keyed property values.

String.prototype.padStart() and padEnd(): Pads the current string with another string until the resulting string reaches the given length.

ES9 (ES2018)

Object.getOwnPropertyDescriptors(): Returns all own property descriptors of an object.

Spread syntax for objects: Allows for easier object cloning and merging.

Promise.prototype.finally(): Adds a handler to be called when a promise is settled, regardless of its outcome.

ES10 (ES2019)

Array.prototype.flat(): Flattens nested arrays.

Array.prototype.flatMap(): Maps each element using a mapping function, then flattens the result into a new array.

String.prototype.trimStart() and trimEnd(): Removes whitespace from the start and end of strings, respectively.

Stable Array.prototype.sort(): Ensures that the sort order is stable.

ES2020 (ES11)

BigInt: A new primitive for arbitrarily large integers.

Nullish Coalescing operator (??): Returns the right-hand operand when the left-hand operand is null or undefined.

Optional chaining operator (?.): Allows for safe property access on deeply nested objects.

Promise.allSettled(): Returns a promise that resolves when all of the given promises have either resolved or rejected.

ES2021 (ES12)

String.prototype.replaceAll(): Replaces all instances of a substring in a string.

Logical assignment operators (&&=, ||=, ??=): Combines logical operations with assignment.

ES2022 (ES13)

Top-level await: Allows the use of await at the top level of modules.

Array.prototype.at(): Provides a way to access elements using negative indices.

Object.hasOwn(): A new method to check if an object has a property as its own property