typescript / beginner
Snippet
The void Return Type
The void type is used as the return type for functions that perform an action but do not return a specific value.
snippet.ts
1
2
3
function sayHello(): void {console.log("Hello World");}
Breakdown
1
(): void
Explicitly states that the function does not return anything.
2
console.log(...)
A side effect (logging to console) without a return value.