CodeZettaInterview Hub

TypeScript · Types · Senior · Comparison

Explain void vs undefined as return types.

Short Interview Answer

void means callers shouldn't use the return value; undefined is the undefined value type.

Detailed Explanation

Callbacks typed void can return values still. Avoid void for variables storing undefined.

Did you know this answer?