Let's have a play with tuples:
- In the TypeScript playground, let's enter the following example of a tuple variable:
let product: [string, number];
We've initialized a product variable to a tuple type with two elements. The first element is a string and the second a number.
- We can store a product name and its unit price in the product variable on the next line, as follows:
product = ["Table", 500];
- Let's try to store the product name and unit price the...