Web
Analytics
Typescript Arrays | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

Typescript Arrays

// Array 
// let arraname : string [] = ['Yogesh', 'sharma'];
// arraname.push('Vikas');
// for(var i=0;i<arraname.length;i++)
// {
//     console.log(arraname[i]);
// }

// let arraname : (string | number)[] = ['Yogesh', 'sharma', 12, 'sdhsd'];
// arraname.push('Vikas');
// for(var i=0;i<arraname.length;i++)
// {
//     console.log(arraname[i]);
// }
//foreach, filter, series, map
// let array2 : number[] =[2,3,4];
// let array3 = array2.map(x=>x*2);
// console.log(array3);

//foreach
// let array4 : number[] = [2,3,4];
// array4.forEach(function(value){
//     console.log(value*3);
// })

// let array1 : number [] = [23,4,5,-45,10,-3];
// function filterarray(element, index, array)
// {
//     return element > 0;
// }
// let array2 = array1.filter(filterarray);
// console.log(array2);

// let myArr3: boolean[] = new Array();
// let myArr4: boolean[] = Array();
// myArr3.push(true);
// myArr4.push(false);

let scores1: number[] = [10, 20, 30];   
let scores2: number[] = [40, 50, 60];   
 
let mergedScore = [scores1,scores2];
 
console.log(mergedScore);