The spread operator (...) expands elements while the rest operator collects elements into an array. Spread is useful for array manipulation, object copying, and function arguments. Rest parameters enable handling variable numbers of arguments in functions. Consider performance implications with large arrays and proper type checking when using these operators.
Map allows any type as keys and maintains insertion order, while Set stores unique values. Both provide efficient lookup and iteration methods. WeakMap and WeakSet variants enable proper garbage collection of key objects. Consider use cases for each collection type, proper cleanup handling, and performance implications.
Symbols are unique and immutable primitive values, often used as property keys to avoid name collisions. They provide a way to create non-enumerable object properties and define well-known symbols for language-level behaviors. Consider Symbol usage for private-like properties, proper Symbol registration, and handling Symbol serialization.
Generators provide a way to define iterative algorithms by writing functions that can be paused and resumed. They work with the iteration protocols, enabling custom iteration behavior. Generators are useful for handling streams of data and implementing complex control flow. Consider proper error handling, memory usage, and understanding of the yield keyword.
async/await provides synchronous-looking code for asynchronous operations, building on Promises. It improves code readability, error handling through try/catch, and maintains proper error stack traces. Consider proper error handling, understanding of the event loop, and limitations in certain contexts.
Improvements include rest parameters, default parameters, and destructuring in parameters. These features provide more flexible and expressive function definitions. Consider proper parameter ordering, destructuring patterns, and compatibility requirements.
BigInt enables working with large integers beyond Number.MAX_SAFE_INTEGER. Numeric separators improve readability of large numbers. Consider type coercion rules, performance implications, and proper numeric literal formatting.
New string methods include startsWith(), endsWith(), includes(), padStart(), and padEnd(). These methods improve string manipulation capabilities and reduce the need for regular expressions. Consider proper method selection and compatibility requirements.
Static class fields and methods belong to the class itself rather than instances. They provide utility functionality and shared state at the class level. Consider proper usage patterns, inheritance behavior, and initialization timing.
Spread operator and Object.assign() provide improved methods for shallow copying arrays and objects. Consider proper deep copying requirements, performance implications, and prototype handling.
ES6 modules provide a standardized way to organize and share code between JavaScript files. They support named and default exports/imports, enabling better code organization and encapsulation. Modules are always in strict mode, have their own scope, and are executed only once when imported. Consider proper module organization, circular dependency handling, and build tool configuration for module bundling.
WeakMap and WeakSet hold weak references to objects, allowing garbage collection of key objects when no other references exist. They are useful for storing metadata about objects without preventing their cleanup. Consider proper use cases, limitations, and garbage collection behavior.
Private class fields and methods (marked with #) provide true privacy in class definitions. They are enforced by the JavaScript engine and not accessible outside the class. Consider proper encapsulation patterns, inheritance implications, and compatibility requirements.
Destructuring patterns support default values for both object properties and array elements. Default values are used when the extracted value is undefined. Consider proper default value expressions, nested destructuring, and undefined handling.
Destructuring enables extracting values from arrays or properties from objects into distinct variables using a concise syntax. It supports default values, nested destructuring, and rest parameters. This feature significantly improves code readability when working with complex data structures and function parameters. Consider using destructuring in function parameters and import statements for cleaner code organization.
ES6 classes provide a clearer syntax for object-oriented programming, supporting inheritance through extends, constructor methods, static methods, and getter/setter syntax. They enforce new for instantiation and automatically enable strict mode. While classes are primarily syntactic sugar over prototypes, they improve code organization and readability. Consider proper inheritance hierarchies and encapsulation patterns.
let and const provide block scoping, preventing hoisting issues and temporal dead zone considerations. const prevents reassignment but not object mutation. These declarations improve code predictability and help catch errors early. Consider using const by default and let only when reassignment is necessary.
ES6+ adds features like named capture groups, lookbehind assertions, and the sticky flag. These enhancements improve regular expression capabilities and maintainability. Consider compatibility requirements, proper pattern construction, and performance implications.
Dynamic import() enables loading modules on demand, returning a Promise for module loading. This feature enables code splitting and conditional module loading. Consider proper error handling, bundling configuration, and performance optimization.
These methods provide different levels of object immutability. freeze() prevents all modifications, seal() prevents property addition/deletion, and preventExtensions() prevents property addition. Consider proper immutability requirements and performance implications.
Arrow functions provide a concise syntax for writing function expressions and maintain lexical this binding. Unlike traditional functions, arrow functions do not create their own this context, inheritance comes from the enclosing scope. They cannot be used as constructors, do not have their own arguments object, and are always anonymous. Consider using arrow functions for callbacks and methods that don't require their own this context.
Template literals provide enhanced string functionality through backtick syntax, supporting multi-line strings, string interpolation with ${expression}, and tagged templates for custom string processing. They eliminate the need for string concatenation and escape sequences for line breaks. Tagged templates enable powerful string manipulation through custom processing functions. Consider performance implications when using complex expressions in interpolation.
Promises represent eventual completion of asynchronous operations, providing a cleaner alternative to callbacks. They support chaining through .then(), error handling with .catch(), and cleanup with .finally(). Promises help avoid callback hell and provide better error propagation. Consider proper error handling, Promise composition patterns, and understanding of the microtask queue.
Enhanced object literals support shorthand property and method definitions, computed property names, and super references. These features make object creation more concise and flexible. Consider proper usage of computed properties, method shorthand limitations, and super reference constraints.
Default parameters allow specifying default values for function parameters when no argument is provided. They support expressions and previous parameter references. This feature improves function flexibility and reduces boilerplate code. Consider evaluation timing of default values and proper parameter ordering.
Proxy enables custom behavior for fundamental object operations, while Reflect provides methods for controlled object manipulation. These features enable powerful metaprogramming capabilities, including property access interception and custom validation. Consider performance implications and proper trap implementation.
Tagged template literals allow custom processing of template literal strings and expressions through tag functions. They enable DSL creation, sanitization, and localization features. Consider proper tag function implementation, performance implications, and security considerations.
New array methods include find(), findIndex(), includes(), flat(), and flatMap(). These methods enhance array manipulation capabilities and improve code readability. Consider proper method selection, performance implications, and polyfill requirements for older browsers.
Optional chaining (?.) provides safe property access, while nullish coalescing (??) provides default values for null/undefined. These operators improve code safety and reduce boilerplate. Consider proper operator usage and compatibility requirements.