null, undefined, and Strict Null Checks
Handle null and undefined safely with strict mode.
Welcome
In JavaScript, null and undefined are common sources of runtime errors. TypeScript's strict null checks force you to handle them explicitly.
null vs undefined
`undefined` means a variable has been declared but not assigned. `null` is an intentional absence of value. Both are separate types in TypeScript.
let a: undefined = undefined;
let b: null = null;All lessons in this course
- Primitive Types: string, number, boolean
- The any Type and Why to Avoid It
- unknown vs any: The Safer Choice
- null, undefined, and Strict Null Checks