TypeScript for … of with index / key?

As described here TypeScript introduces a foreach loop:

var someArray = [9, 2, 5];
for (var item of someArray) {
    console.log(item); // 9,2,5
}

But isn’t there any index/key? I would expect something like:

for (var item, key of someArray) { ... }

5 Answers
5

Leave a Comment