Skip to content
JavaScript·Advanced·Conceptual·1 min read

How does new interact with an explicitly returned object?

Short interview answer

If a constructor explicitly returns an object, that object replaces the newly created receiver. Returning a primitive does not replace the constructed instance.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to The this keyword

Related questions