TypeScript Hindi Tutorial #12 Tuple Data Type

Tuple Data Type


What is Tuple Data Type.

A tuple is a fixed-length,

Ordered collection of different types.

Each element in a tuple has a specific type.


tuple.ts

let user: [number, string, boolean]= [1, "Anil Sidhu", true];
var emp:string[]=['anil','sam','peter'];
var empData: readonly[string,number,boolean,number,string]=['anil',30,true,100000,''];

// empData.push('noida');
console.log(empData);


tuple.js

"use strict";
var emp = ['anil', 'sam', 'peter'];
var empData = ['anil', 30, true, 100000, ''];
// empData.push('noida');
console.log(empData);