Fact-checked by Grok 2 weeks ago

Null coalescing operator

The null coalescing operator, typically denoted by the double question mark (??), is a binary in various programming languages that evaluates to its left-hand operand if that operand is not (or, in some implementations, not nullish, meaning neither nor ); otherwise, it evaluates to its right-hand operand, providing a concise for assigning default values and avoiding null reference exceptions. Introduced in C# 2.0 as part of the .NET Framework 2.0 release in November 2005, the operator works with both reference types and nullable value types, allowing expressions like string name = userName ?? "Anonymous"; to return userName if non-null or "Anonymous" as a fallback. This feature complemented the simultaneous introduction of nullable value types (T?), enhancing null safety in code. Later enhancements in C# 8.0 (2019) added the null-coalescing assignment operator (??=), which assigns the right operand to the left only if the left is null. The gained prominence in with version 7.0 in December 2015, where it serves as for the common pattern of checking isset() with a , as in $username = $_GET['user'] ?? 'Anonymous';, returning the left value if it exists and is not [NULL](/page/Null), or the right otherwise. 7.4 () extended this with the null-coalescing assignment (??=), streamlining updates to variables. In , the nullish coalescing operator (??) was standardized in 2020 (ES2020) and became widely supported in browsers by mid-2020; it specifically targets null or undefined (nullish values), distinguishing it from the logical OR operator (||) by not treating other falsy values like empty strings or zero as triggers for the fallback. For example, const value = maybeNull ?? defaultValue; assigns defaultValue only if maybeNull is nullish. 2021 introduced the nullish coalescing assignment (??=), enabling assignments like foo ??= bar; to set foo to bar if foo is nullish. Similar operators appear in other languages, such as 's nil-coalescing operator (??) for optionals since Swift 1.0 (2014), and Rust's unwrap_or method or for handling Option types, though not identically named. These implementations collectively address a common need for safer null handling, reducing and improving readability across object-oriented, functional, and scripting paradigms.

Definition and Purpose

Core Concept

The null coalescing operator is a binary operator, typically represented by the symbols ??, that returns the value of its left-hand if that is not (or an equivalent null-like value, such as undefined in or nil in other languages); otherwise, it returns the value of its right-hand . This operator provides a concise syntactic construct for handling potentially absent values in expressions, evaluating the right only when necessary to avoid unnecessary computations. Unlike broader conditional operators, such as the logical OR (||), the null coalescing operator specifically checks for null-like states and does not treat other falsy values—such as , empty strings, or false—as triggers for fallback to the right operand. For example, 0 ?? "default" evaluates to 0, preserving the intended meaning of numeric or values that happen to be falsy. This precision ensures that the operator supports accurate null handling without unintended side effects from type coercion or falsy logic. At its core, the null coalescing operator mitigates exceptions and related runtime errors by enabling developers to embed safe default values directly in code, reducing reliance on explicit conditional statements like if checks. The name "coalescing" derives from the concept of values merging or fusing into a single non-null result, selecting the first available valid operand in a chain. This foundational design promotes cleaner, more readable code while enhancing robustness against null-related failures common in object-oriented and dynamic programming paradigms.

Use Cases

The null coalescing operator is commonly employed for default value assignment, where it assigns a fallback value to a or expression if the primary source evaluates to , thereby streamlining code that would otherwise require explicit null checks. For instance, when processing user input that may be absent, a developer might set a to the input if available or to a predefined default otherwise, reducing boilerplate and enhancing readability. This pattern is particularly valuable in scenarios involving optional parameters or uninitialized , as seen in languages like C#, , and . Chaining multiple null coalescing operations enables layered fallback mechanisms, allowing code to select the first non-null value from a sequence of potential sources, such as a series of configuration options or nested object properties. This right-associative behavior supports concise expressions for hierarchical defaults, like retrieving a value from a primary source, then a secondary cache, and finally a hardcoded constant, without nested conditionals. Such chains promote cleaner handling of multi-level data dependencies. In configuration handling, the operator facilitates safe retrieval of settings from sources like environment variables, configuration files, or databases, providing built-in defaults to avoid runtime failures when values are missing or unset. For example, it can extract a database from an or revert to a default, ensuring applications remain robust across deployment environments without extensive validation logic. This approach is widely adopted in frameworks for its efficiency in managing optional settings. For API response processing, the null coalescing operator aids in safely extracting data from potentially null objects, such as parsed payloads or remote service outputs, by supplying defaults for absent fields. This prevents cascading null propagation in data pipelines, for instance, when displaying user details from an that might omit optional attributes, allowing seamless rendering of fallback content like placeholder text or empty states. By encapsulating null checks into a single , it significantly reduces the risk of null reference exceptions in expressions, enabling one-liner constructs that replace verbose if-else blocks and minimize common sources of bugs in null-prone codebases. This error reduction is especially beneficial in large-scale applications where handling is frequent, contributing to more maintainable and less error-prone code.

Syntax and Behavior

General Form

The null coalescing operator is a binary operator commonly represented by the double (??), with the general syntactic form leftOperand ?? rightOperand. This structure evaluates the left operand first and returns the right operand only if the left is , serving as a concise way to provide default values in expressions. The left can be of any type that may evaluate to a or nullish state, depending on the implementation, while the right supplies the fallback . For instance, in a , it might appear as result = nullableValue ?? defaultValue;, where the operator integrates seamlessly into larger code constructs. This is employed in various expression contexts, such as , returns, or embedded within conditional , but it cannot stand alone as a . Regarding operator precedence, ?? typically binds more tightly than operators (like =) but less tightly than operators (like ==), requiring parentheses in mixed expressions for clarity. An extension in some implementations is the null-coalescing assignment (??=), which updates the left with the right 's value only if the left is , as in variable ??= defaultValue;. This variant streamlines code for initializing or updating variables with defaults.

Evaluation Rules

The null coalescing evaluates its left first. If the left is not , it is returned immediately, and the right is not evaluated at all—this short-circuiting behavior optimizes performance by avoiding unnecessary computations, particularly when the right involves expensive operations or side effects. In this context, "" specifically refers to null-like states such as [null](/page/Null) for reference types, [undefined](/page/Undefined) in dynamic languages, or unset variables, but excludes other falsy values like false, 0, empty strings, or [NaN](/page/NaN). This distinction ensures that valid but falsy data is preserved rather than replaced by the right operand. For instance, if the left operand is the boolean false, the operator returns false without considering the right operand. The operator always returns the value of the non-null . If the operands are of compatible types, the result's type is typically a or the common supertype of both, allowing flexible usage in type-safe languages. Side effects in the right operand, such as calls or accesses, are only triggered if the left operand is , which can prevent errors or resource waste—for example, in an expression like getUserName() ?? "[Anonymous](/page/Anonymous)", a potentially expensive call on the left is always evaluated, but if considering the right, it would be skipped if the left is non-null. The null coalescing operator is right-associative, meaning expressions like a ?? b ?? c are parsed as a ?? (b ?? c), enabling chained defaults from left to right. It generally has the same or lower precedence than the logical OR (||) operator but lower than (==) or operators, requiring parentheses in mixed expressions to avoid ambiguity—such as (x == null) ?? y to ensure correct grouping. This precedence allows integration with other operators while maintaining clarity in compound expressions.

Historical Development

Origins in C#

The null coalescing operator (??) was first introduced in C# 2.0, which was released in November 2005 alongside the .NET Framework 2.0. This operator provided a mechanism to return the left-hand if it was non-null, or the right-hand otherwise, specifically targeting reference types and the newly introduced nullable value types. Its inclusion marked a significant step in addressing common null-handling patterns that previously required verbose conditional logic. Led by , the chief architect of C# since its inception, and his development team at , the operator was designed to simplify the assignment of default values to nullable types and references, reducing the reliance on explicit checks and improving readability and safety. This motivation stemmed from the need to streamline expressions involving potential values, a challenge amplified by the simultaneous introduction of nullable value types (e.g., int?) in C# 2.0, which allowed value types to represent undefined states. By enabling concise defaults—such as expression1 ?? expression2—the operator mitigated risks associated with reference exceptions in everyday programming scenarios. The 's initial syntax was defined as a right-associative binary with precedence below conditional AND (&&) and above the (?:), applicable only to nullable or reference types without support for overloading. It was formally specified in the third edition of the ECMA-334 C# language standard, published in June 2005, which outlined its rules: the right is evaluated only if the left is , and the result type is determined via implicit conversions between operands. From its debut, the operator saw rapid integration within the .NET 2.0 ecosystem, fostering safer application development.

Spread to Other Languages

Following the introduction of the null coalescing operator in C# with 2.0 in 2005, the concept of providing a concise for handling values spread to several other programming languages, often inspired by the need for improved null safety in dynamic or object-oriented environments. adopted the null coalescing operator (??) in version 7.0, released on December 3, 2015, as to replace common isset() checks combined with operators, returning the left if it exists and is not , otherwise the right . 7.4, released in November 2019, introduced the null-coalescing assignment (??=). Kotlin, which emphasized null safety from its inception, introduced the (?:) in its initial preview release in July 2011, functioning similarly by returning the left expression if non-null or the right as a default, though it builds on -like for broader null-aware operations. version 3.0, released in September 2012, incorporated null coalescing behavior through conditional logic enhancements like the -or operator for handling $null values in pipelines, aiding scripting null safety without a dedicated operator until 7.0 in 2020. Swift integrated the nil coalescing operator (??) upon its public launch with version 1.0 in September 2014, unwrapping optionals if they contain a value or providing a default, directly borrowing from C#-style null safety to streamline optional chaining in its type-safe ecosystem. , emphasizing and safety without null pointers, provided equivalent functionality via the unwrap_or on Option types starting with its 1.0 stable release in May 2015, returning the contained value if Some or a default if None, though as a method rather than an operator to fit its functional paradigm. More recently, formalized the nullish coalescing operator (??) in 2020 (ES2020), approved at TC39 stage 4 in October 2019 and shipped in major browsers like Chrome 80 and 72 starting in early 2020, distinguishing null or from falsy values like empty strings for precise defaulting. This adoption reflected growing demand for null-safe expressions in , with the originating in 2017 to address limitations of the logical OR (||) operator. 2021 introduced the nullish coalescing assignment (??=). Evolving trends include extensions like the null-coalescing assignment operator (??=) in C# 8.0, released in September 2019, which assigns the right to the left only if the left is , reducing boilerplate in mutable contexts.

With Logical OR

The logical OR operator (||) evaluates to its right-hand operand when the left-hand operand is falsy, where falsy values encompass not only null but also other values such as false, 0, or an empty string "", depending on the language's type coercion rules. In contrast, the null coalescing operator (??) specifically checks for null (or undefined in some languages) and preserves non-null falsy values as valid results. For instance, "" ?? "default" evaluates to "", whereas "" || "default" evaluates to "default", demonstrating how || can inadvertently override intended falsy inputs. This distinction highlights a key pitfall of relying on || for null safety: it may apply unintended defaults to legitimate falsy values, such as a boolean false indicating a deliberate choice or a numeric 0 representing a valid quantity, leading to logical errors in applications where such values carry semantic meaning. The logical OR operator remains suitable for scenarios requiring broad truthy checks, such as simple conditional fallbacks where any falsy input warrants a replacement, but it falls short for null-specific safeguards that respect the nuances of falsy distinctions. A common example arises in handling, where an absent value () should default to a preset, but a present "" is a valid user-supplied option indicating no preference, avoiding overrides that could alter intended behavior.

With Elvis and Ternary Operators

The , with the syntax condition ? trueValue : falseValue, enables concise if-then-else expressions in many programming languages, including C# and . However, when applied to simple checks, such as determining a default if a variable is , it often requires explicit conditionals like value != null ? value : defaultValue, which can introduce verbosity and potential errors if the null check is overlooked. The , typically denoted as ?:, serves as a for the operator in languages such as and , where expr ?: default expands to expr ? expr : default and evaluates the left for rather than strict nullity. In , for instance, it returns the left if it is not falsy under Groovy's truth semantics (e.g., non-, non-empty, non-zero), otherwise the default; this reduces code duplication compared to the full but may treat empty strings or zero as falsy, unlike null coalescing. Similarly, in , the checks if the left is truthy, potentially issuing notices for undefined variables unless guarded. In contrast, Kotlin's ?: specifically checks for and returns the left if non-null, aligning more closely with null coalescing behavior while still deriving from . Key differences arise in their evaluation logic: the null coalescing operator focuses exclusively on null (or undefined in some contexts) without requiring a condition or truthiness evaluation, making it safer and more direct for default assignments. The Elvis and ternary operators, however, support arbitrary conditions, allowing broader logic but risking null reference exceptions or unexpected falsy evaluations without additional safeguards, such as explicit null checks. For example, in PHP, $username ?: 'Guest' uses Elvis for a quick truthy default, but $username ?? 'Guest' with null coalescing ignores falsy non-null values like empty strings. Where overlap exists, such as providing fallback values, the choice depends on intent: null coalescing suits pure null defaults without side effects from truthiness, while ternary or Elvis fits scenarios needing custom or complex conditions. Historically, the Elvis operator draws inspiration from the C ternary operator introduced in the 1970s and appeared in modern languages like Groovy in version 1.5 (December 2007) and PHP 5.3 (June 2009), sometimes predating dedicated null coalescing operators in those ecosystems, such as PHP's ?? in version 7.0 (December 2015).

Implementations in Programming Languages

C#

In C#, the null coalescing operator, denoted by ??, provides a concise way to return the left-hand operand if it is not null, or the right-hand operand otherwise. The right-hand operand is only evaluated if the left-hand operand evaluates to null, enabling . This operator supports both reference types, such as strings, and nullable value types, like int?, but cannot be used with non-nullable value types. For example:
csharp
string name = null;
string displayName = name ?? "Anonymous";  // Results in "Anonymous"
The result type of the expression is determined by the operands: if both are of the same type, the result is that type; if they differ, it promotes to a common type in the hierarchy, such as unwrapping a nullable value type to its underlying non-nullable type when compatible (e.g., int? and int yield int). If no common type exists, the result is object. Chaining multiple null coalescing operators, such as a ?? b ?? c, is right-associative, meaning it groups as a ?? (b ?? c), but evaluation proceeds left-to-right with short-circuiting: it checks a first, then b if needed, and finally c. This allows for fallback cascades without nested conditionals. The operator integrates seamlessly with the null-conditional operator ?. for safe navigation, providing defaults for potentially null properties or method calls, as in obj?.Property ?? defaultValue. Introduced in C# 8.0 (released in 2019), the null coalescing assignment operator ??= assigns the right-hand operand to the left-hand operand only if the left-hand is null, simplifying null checks in scenarios like initialization or updates. The left-hand must be a variable, property, or indexer, and the right-hand is not evaluated unless necessary. This form enhances brevity in loops or repeated assignments, replacing verbose if statements. For instance:
csharp
List<int>? numbers = null;
numbers ??= new List<int>();  // Assigns new list if null
numbers.Add(5);

PHP

In PHP, the null coalescing operator serves as a concise mechanism for handling potentially null or unset values, particularly valuable in dynamic web applications where variables from user input may be absent. Introduced in PHP 7.0, it provides syntactic sugar to replace verbose expressions like isset($variable) ? $variable : $default, enabling cleaner code for default value assignments without triggering notices for undefined variables. This operator is especially useful in server-side scripting for processing form data and query parameters, reducing boilerplate while maintaining robustness against incomplete inputs. The syntax of the null coalescing operator is $left ?? $right, where it evaluates to $left if that operand exists and is not null; otherwise, it returns $right. Unlike the logical OR operator (||), which treats any falsy value (such as empty strings, zero, or false) as grounds for fallback, the null coalescing operator strictly checks for null or unset states, preserving non-null but falsy values like an empty string. It also avoids emitting PHP notices for accessing undefined variables or array keys, making it safer for direct use with superglobals like $_GET or $_POST. For instance, $action = $_POST['action'] ?? 'default'; assigns the submitted value if present and non-null, or 'default' otherwise, without warnings even if the key is missing. Chaining of the null coalescing operator has been supported since 7.0, allowing multiple fallbacks in a single expression evaluated from left to right. An example is $result = $userInput ?? $sessionValue ?? 'default';, which returns the first non-null value encountered in the chain. This feature enhances readability in scenarios involving layered data sources, such as combining user input, cached data, and hardcoded defaults. The operator integrates seamlessly with array access, a common pattern in PHP for handling web requests. For example, $id = $_GET['id'] ?? 0; safely retrieves a query parameter as an integer default, treating missing or null keys without errors. In PHP 7.4, the null coalescing assignment operator ??= was added, enabling shorthand assignments like $array['key'] ??= $defaultValue;, which sets the key only if it is unset or null, equivalent to an if (!isset($array['key'])) check. This maintains backward compatibility with pre-7.0 versions through traditional isset() checks, ensuring gradual adoption in legacy codebases.

JavaScript

The nullish coalescing (??) in , standardized in ECMAScript 2020 (ES2020), is a logical that returns its right-hand side when the left-hand side is either null or undefined; otherwise, it returns the left-hand side . This specifically targets "nullish" values, distinguishing them from other falsy values such as 0, '', false, or NaN, which are treated as valid by ?? but would trigger fallbacks with the logical OR (||). For instance:
javascript
let value = 0;
console.log(value ?? 'default');  // 0 (preserves the falsy but defined value)
console.log(value || 'default');  // 'default' (treats 0 as falsy)
This behavior makes ?? particularly useful for providing default values without overriding intentional falsy inputs. The proposal for the nullish coalescing operator originated within the TC39 committee, the body responsible for evolving the ECMAScript standard, and advanced to stage 4 (finished) in July 2019 before inclusion in ES2020. It directly addresses longstanding issues with || in default parameter assignments and conditional logic, such as user.age || 18, which incorrectly defaults a valid age of 0 to 18. The nullish coalescing operator ?? is right-associative, enabling natural chaining like a ?? b ?? c, which evaluates as a ?? (b ?? c) and returns the first non-nullish value from left to right. Browser support for ?? has been stable since early 2020, with full implementation in 80+, 72+, 13.1+, and 80+ across desktop and mobile environments. For legacy support in older browsers or versions, transpilers like Babel provide plugins to transform ?? into compatible code, while libraries such as core-js offer runtime polyfills. The operator pairs effectively with the optional chaining operator (?.), also from ES2020, to handle nested property access safely with fallbacks. An example is obj?.prop ?? 'fallback', which returns 'fallback' only if obj is null/undefined or prop is nullish, avoiding runtime errors from undefined references. This combination enhances code readability and robustness in scenarios involving optional data structures, such as API responses or user inputs.

Other Languages

In , introduced with version 1.0 in 2014, the nil-coalescing operator ?? unwraps an optional value on the left if it is non-nil, otherwise returning the default value on the right; it is used alongside optional binding like if let for safe handling of potentially missing values. , since its 1.0 release in 2015, provides functional equivalents to null coalescing through methods on the Option<T> enum, such as unwrap_or(default) which returns the contained value if present or the provided default otherwise, and unwrap_or_else(|| default) for of the default. Kotlin, first released in 2011, employs the ?: for nullable types, which returns the left if non- or the right as a default (which could itself be ), effectively combining null checks with expression evaluation. The SQL standard, as defined in ISO/IEC 9075:1992 (), includes the COALESCE function, which accepts multiple arguments and returns the first non- value encountered, serving as an early multi-argument form of null coalescing that influenced later language designs. Perl introduced the defined-or operator // in version 5.10.0 (2008), which returns the left if defined (including false values like zero) or the right as default, distinct from logical-or by preserving definedness checks. In version 3.0 (2012), null coalescing is achieved through conditional patterns such as if ($null -ne $var) { $var } else { $default }; the dedicated null coalescing operator ?? was introduced in 7.0 (2019). Variations appear in template and scripting environments; for instance, Apache FreeMarker uses syntax like ${var!'default'} to insert a or fallback string if or . In Unix shells like , parameter expansion such as ${var:-default} provides a similar effect for unset or empty variables, while || handles command-level fallbacks on failure but not directly for null values.

References

  1. [1]
    null-coalescing operators - C# reference | Microsoft Learn
    The `??` and `??=` operators are the C# null-coalescing operators. They return the value of the left-hand operand if it isn't null.The ternary conditional operator · The lambda operator · Namespace alias
  2. [2]
    Nullish coalescing operator (??) - JavaScript - MDN Web Docs
    Aug 26, 2025 · The nullish coalescing ( ?? ) operator is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined.
  3. [3]
    Comparison - Manual - PHP
    The null coalescing operator has low precedence. That means if mixing it with other operators (such as string concatenation or arithmetic operators) parentheses ...
  4. [4]
    The history of C# | Microsoft Learn
    This article provides a history of each major release of the C# language. The C# team is continuing to innovate and add new features.What's new in C# 11 · Relationships between... · Local functions
  5. [5]
    PHP 7.0.0 Release Announcement
    The null coalescing operator (??) Return and Scalar Type Declarations ... The release being introduced is an outcome of the almost two years development journey.
  6. [6]
    New features - Manual - PHP
    The null coalescing operator ( ?? ) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns ...
  7. [7]
    PHP RFC: Null Coalescing Assignment Operator
    Mar 9, 2016 · Coalesce equal or ??= operator is an assignment operator. If the left parameter is null, assigns the value of the right paramater to the left one.
  8. [8]
    Nullish coalescing assignment (??=) - JavaScript - MDN Web Docs
    Jul 8, 2025 · You can use the nullish coalescing assignment operator to apply default values to object properties. Compared to using destructuring and default ...
  9. [9]
    Null Coalescing Operator --> What does coalescing mean?
    Apr 20, 2009 · Coalescing is when you have more than one item and then you end up with exactly one—either by joining the items together or by choosing a single ...c# - Unique ways to use the null coalescing operator - Stack OverflowWhat is the operator precedence of C# null-coalescing (??) operator?More results from stackoverflow.com
  10. [10]
    PHP: Comparison - Manual
    ### Summary of Null Coalescing Operator (??) from PHP Manual
  11. [11]
  12. [12]
  13. [13]
    Operator Precedence - Manual - PHP
    The precedence of an operator specifies how "tightly" it binds two expressions together. For example, in the expression 1 + 5 * 3 , the answer is 16 and not 18.<|control11|><|separator|>
  14. [14]
    Operator precedence - JavaScript - MDN Web Docs - Mozilla
    Sep 22, 2025 · 3: logical OR, nullish coalescing, left-to-right, Logical OR x || y. Nullish coalescing operator x ?? y, [9]. 2: assignment and miscellaneous ...
  15. [15]
    [PDF] ECMA-334, 3rd edition, June 2005
    This International Standard is based on a submission from Hewlett-Packard, Intel, and Microsoft, that describes a language called C#, which was developed ...
  16. [16]
    The C# ?? null coalescing operator (and using it with LINQ)
    Sep 20, 2007 · null coalescing operator was already on C# 2.0!! What's different ... On C# 2.0, I guess we're stuck with the way it is now. John. John ...<|control11|><|separator|>
  17. [17]
    The Complete Guide to the SQL COALESCE Function - DbVisualizer
    Rating 4.6 (146) · $0.00 to $229.00 · DeveloperThe COALESCE SQL function was introduced to the SQL ANSI standard in SQL-92 (also known as SQL2). SQL-92 is a widely adopted SQL standard that was published in ...Missing: history | Show results with:history
  18. [18]
    Null safety | Kotlin
    ### Summary of the Elvis Operator ?: in Kotlin
  19. [19]
    Basic Operators | Documentation - Swift.org
    The nil-coalescing operator provides a more elegant way to encapsulate this conditional checking and unwrapping in a concise and readable form.
  20. [20]
  21. [21]
    tc39/proposal-nullish-coalescing - GitHub
    Jan 28, 2023 · The nullary coalescing operator is intended to handle these cases better and serves as an equality check against nullary values (null or undefined).
  22. [22]
    ?: operator - the ternary conditional operator - C# reference
    ### Summary of Ternary Conditional Operator in C#
  23. [23]
    Conditional expression can be rewritten as null-coalescing - JetBrains
    Sep 23, 2024 · The clearest syntax you can use in these cases is the ?? (null-coalescing) operator. Therefore, whenever ReSharper encounters a conditional ?: (ternary) ...
  24. [24]
    Groovy 1.5 release notes
    As this construct is pretty common, the Elvis operator was introduced to simplify such recurring cases, and the statements become: String name = "Guillaume ...
  25. [25]
    Operators - The Apache Groovy programming language
    Usage of the Elvis operator reduces the verbosity of your code and reduces the risks of errors in case of refactorings, by removing the need to duplicate the ...
  26. [26]
    New Features - Manual - PHP
    A new extension, which provides a simple way to call native functions, access native variables, and create/access data structures defined in C libraries.
  27. [27]
    Nullish Coalescing Operator - TC39
    Jan 21, 2020 · This document specifies the nullish coalescing operator ??. See the explainer for an introduction. The main design decisions made in this specification are:Missing: history | Show results with:history
  28. [28]
    Nullish coalescing operator (`??`) | Can I use... Support tables for ...
    "Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
  29. [29]
    babel/plugin-transform-nullish-coalescing-operator
    This transform will pretend document.all does not exist, and perform loose equality checks with null instead of strict equality checks against both null and ...Example · Installation · Usage · Via Node API
  30. [30]
    Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
    Jul 8, 2025 · Combining with the nullish coalescing operator. The nullish coalescing operator may be used after optional chaining in order to build a ...
  31. [31]
    Swift - Apple Developer
    Dive into Swift tools, documentation, sample code, videos, and more. ... Features such as optional binding, optional chaining, and nil coalescing let you work ...Resources · Documentation · Swift Playgrounds · Swift ChartsMissing: operator | Show results with:operator
  32. [32]
  33. [33]
  34. [34]
  35. [35]
  36. [36]