Answers for "typescript foreach 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
23

foreach jas

const array1 = ['a', 'b', 'c'];

array1.forEach(element => console.log(element));
Posted by: Guest on January-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language