Using the null type

In TypeScript, you can use the null keyword to declare a variable of the null type. When declared, you can only assign a null value to it. Just like undefined, you can also assign it to a number or boolean value as it is a subtype of all other types:

let nullValue: null = null; 
let nullableNumeric: number = null; 
let nullableBoolean: boolean = null; 
If a variable is assigned with undefined, then the variable has no value or object assigned to it. However, if a variable is assigned with null, then the variable is a type of an object whose value hasn't been defined.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.87.95