void in ts

Solutions on MaxInterview for void in ts by the best coders in the world

showing results for - "void in ts"
Emil
12 Jan 2019
1// Similar to languages like Java, void is used where there is no data. 
2// For example, if a function does not return any value then you can 
3// specify void as return type.
4function sayHi(): void { 
5    console.log('Hi!')
6} 
7
8let speech: void = sayHi(); 
9console.log(speech); //Output: undefined
10