for loop typescript] code example
Example 1: for of loop in ts with index
const someArray = [9, 2, 5];
someArray.forEach((value, index) => {
console.log(index); // 0, 1, 2
console.log(value); // 9, 2, 5
});
Example 2: ts for
// foreach - values
for { let item of itemList} {
}
// foreach - keys
for { let key in itemList} {
}
// for
for {let i = 0; i < 10; _i++}{
}