What does 'Value: ' + undefined produce in JavaScript?
'Value: undefined'. The + operator favors string concatenation, so undefined is coerced to the string 'undefined' and concatenated.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in JavaScript Weakly Typed Language and undefined Behavior
NaN. undefined coerces to NaN in numeric contexts, and any arithmetic with NaN produces NaN, which propagates silently through calculations.
Yes. undefined == null is true, a special case in the spec. But undefined === null is false. They are only loosely equal to each other, not to any other value.
No. Defaults apply only when the argument is undefined or omitted. Passing null, 0, or empty string does not trigger the default, because those are real values.
Still have questions?
Browse all our FAQs or reach out to our support team
