For in loop - typescript full explanation

 For..in the loop is used for iterating on array in typescript. For..in loop return the index of array elements.this loop can be used with Array,List,Tupel

Syntax: 

for(let index in <some array>){

    //statements 

}

For Example :

let person = ["SAM","BOM","BOB","NIL"]

for(let index in person){

console.log("index"+index);   // this will print index

console.log("name : " + person[index] );   // this will print array's value. 

}






Comments

Popular posts from this blog

public static void main(String [] args) - Full Explanation

Coding Problem 3 - Weather Observation Station 7 [HackerRank - SQL]

Date Range Picker In Angular 10