Answers for "for of loop in ts with index"

3

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
});
Posted by: Guest on August-18-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language