Explore Library
QuizAdvanced

Type Inference and Union Types

Understanding how TypeScript infers types and handles union types with let declarations.

What type does TypeScript infer for the variable `x` in `let x = Math.random() > 0.5 ? "hello" : 42;`?