November 2018
Beginner
502 pages
10h 22m
English
void is another type that doesn't exist in JavaScript. It is generally used to represent a non-returning function.
Let's look at an example:
function logText(text: string): void { console.log(text);}
The function simply logs some text into the console and doesn't return anything. So, we've marked the return type as void.

This saves us a few keystrokes while writing functions that don't return anything.
Read now
Unlock full access