Google News
logo
TypeScript - Interview Questions
Explain Tuples in Typescript With Example
Tuples are a collection of values that are diverse. It allows for the storage of many fields of various sorts. Tuples can also be used as function parameters.
 
There are instances when it is necessary to save a collection of values of various types. Arrays will not suffice in this situation. TypeScript provides a data type called tuple that aids in this endeavor.
 
Syntax :
var tuple_name = [value c,value b,value c,…value n]
For Example :
var yourtuple = [12,"Hi"];
Advertisement