1.

What is void, and when to use the void type?

Answer»

The void indicates the ABSENCE of type on a variable. It acts as the opposite type to any. It is especially USEFUL in FUNCTIONS that don’t return a value.

function notify(): void { alert("The user has been notified.");}

If a variable is of type void, you can only assign the null or undefined VALUES to that variable. 



Discussion

No Comment Found