It's called the Short-circuit evaluation and it's a feature of TypeScript. Not JavaScript .

When whatever before ? Is null or undefined, whatever after ?. Won't be called. That's to avoid errors like: undefined has no property removeEventListener

Edit

I was wrong when I said it's not a feature of JavaScript. It's actually a new feature. Some browsers that are not updated to the latest don't support it yet (like mine)

Answer from TSR on Stack Overflow
🌐
freeCodeCamp
freecodecamp.org › news › how-the-question-mark-works-in-javascript
How the Question Mark (?) Operator Works in JavaScript
February 3, 2021 - By Nishant Kumar The conditional or question mark operator, represented by a ?, is one of the most powerful features in JavaScript. The ? operator is used in conditional statements, and when paired with a :, can function as a compact alternative ...
🌐
JavaScript in Plain English
javascript.plainenglish.io › 3-uses-of-in-javascript-why-pro-developers-love-using-javascript-operator-565bc8b235a4
3 Uses of ‘?’ in JavaScript❓. How ( ? / ?? / ?. ) operators work in… | by Sayyed Hammad Ali | JavaScript in Plain English
August 2, 2024 - The second operator on our list is a very useful JS operator. The JavaScript double question mark operator ( ?? ) is known as the Nullish Coalescing operator. It’s a logical operator that returns its right-hand side operand when its left-hand ...
Discussions

What is the meaning of the question mark in javascript - but it is not a ternary operator? - Stack Overflow
See How the Question Mark (?) Operator Works in JavaScript. More on stackoverflow.com
🌐 stackoverflow.com
syntax - Question mark and colon in JavaScript - Stack Overflow
536 How do you use the ? : (conditional) operator in JavaScript? ... 3 How multiple question marks "?" and colons ":" in one statement are interpreted in javascript? More on stackoverflow.com
🌐 stackoverflow.com
How multiple question marks "?" and colons ":" in one statement are interpreted in javascript? (Conditional Operators) - Stack Overflow
@gcampbell should all colons and question marks be interpreted from right to left like the other operators? ... Javascript is right-associative, so you 'resolve' the ternaries from right to left. More on stackoverflow.com
🌐 stackoverflow.com
New Nullish Coalescing (?? Double question mark ) Operator in Typescript & Javascript

It's very recent, it was moved to stage 4 (Finished) 5 months ago https://github.com/tc39/proposal-nullish-coalescing

More on reddit.com
🌐 r/javascript
6
4
May 12, 2019
🌐
Built In
builtin.com › software-engineering-perspectives › javascript-question-mark-operator
JavaScript Question Mark (?) Operator Explained | Built In
July 17, 2025 - The question mark operator ? takes three operands: a condition, a value if that condition is true and a value if that condition is false. It’s used in JavaScript to shorten an if else statement to one line of code.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Optional_chaining
Optional chaining (?.) - JavaScript | MDN
The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called using this operator is undefined or null, the expression short circuits and evaluates to undefined instead of throwing an error.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › javascript fundamentals
Conditional branching: if, '?'
To do that, we can use the if statement and the conditional operator ?, that’s also called a “question mark” operator.
🌐
Robin Wieruch
robinwieruch.de › javascript-variable-question-mark
JavaScript Variable with Question Mark
September 30, 2019 - The question mark in JavaScript is commonly used as conditional operator -- called ternary operator when used with a colon (:) and a question mark (?) -- to assign a variable name conditionally.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Conditional_operator
Conditional (ternary) operator - JavaScript | MDN
The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy.
Find elsewhere
🌐
Eran Stiller
eranstiller.com › javascript-double-question-marks
What Is the JavaScript Double Question Marks (??) Operator?
September 24, 2023 - The double question marks operator offers a reliable, concise way to set default values and avoid errors in your code. Remember, it’s all about preventing those pesky null or undefined values from causing havoc in your JavaScript programs.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Nullish_coalescing
Nullish coalescing operator (??) - JavaScript | MDN
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, and otherwise returns its left-hand side operand.
🌐
CoreUI
coreui.io › blog › what-is-double-question-mark-in-javascript
What is Double Question Mark in JavaScript? · CoreUI
March 12, 2024 - As of its introduction in ECMAScript 2020, the ?? operator is supported in most modern browsers and JavaScript environments, including Node.js versions that are based on newer V8 engines. However, for older environments or browsers that do not support ECMAScript 2020 features, a transpiler like Babel may be required to ensure compatibility. The double question mark operator enriches JavaScript’s syntax by offering a clear and concise way to handle null and undefined values.
🌐
Scaler
scaler.com › home › topics › what is a nullish coalescing operator or double question mark (??) in javascript?
What is JavaScript double question mark (??) - nullish coalescing operator - Scaler Topics
March 28, 2024 - The Nullish coalescing operator ... question mark is a logical operator that takes two values and returns the right-hand value if the left-hand value is undefined or null, Else returns the left-hand operand....
🌐
Medium
medium.com › totally-typescript › what-does-the-question-mark-dot-mean-in-javascript-or-typescript-9d7d744f6077
What Does the ?. Question Mark Dot Mean in JavaScript or TypeScript? | by Dr. Derek Austin 🥳 | Totally TypeScript | Medium
May 16, 2023 - What Does the ?. Question Mark Dot Mean in JavaScript or TypeScript? Unraveling the mystery of the ?. optional chaining operator with practical examples Introduction: Optional Chaining in JS / TS …
🌐
Educative
educative.io › answers › how-the-question-mark-operator-works-in-javascript
How the question mark (?) operator works in JavaScript
In this example, we determine whether a person is an adult based on their age using the ? operator. If the age is greater than 18, isAdult will be assigned the value Yes; otherwise, it will be assigned No. The question mark operator can also be used inside a function call to make decisions based on the parameters passed in the function.
🌐
Flexiple
flexiple.com › javascript › double-question-mark-javascript
The Double Question Mark (??) in JavaScript - Flexiple
The ?? operator in JavaScript is known as the nullish coalescing operator. It returns the right-hand operand when the left-hand operand is either null or undefined. This operator provides a reliable way to specify default values.
🌐
BetterBugs
betterbugs.io › blog › javascript-double-question-mark-nullish-coalescing-operator
What is JavaScript Double Question Mark (??) or the Nullish Coalescing Operator?
April 10, 2024 - Simply put, the double question mark (??) operator returns the right-hand operand if the left-hand operand evaluates to a nullish value (either null or undefined).
🌐
Kodeclik
kodeclik.com › question-mark-in-javascript
The question mark (?) operator in Javascript
July 15, 2025 - The question mark operator, represented by a ?, is a powerful feature in JavaScript that is used in conditional statements, and when paired with a :, can function as a compact alternative to if...else statements. There are three main uses for the ?