Answers for "for loops for index and"

2

for of with index

for (const [index, value] of [1, 2, 3, 4, 5].entries()) {
  console.log(index, value);
}
Posted by: Guest on June-18-2021
5

for of with index

for (const [i, v] of ['a', 'b', 'c'].entries()) {
  console.log(i, v)
}
Posted by: Guest on November-29-2019

Code answers related to "Javascript"

Browse Popular Code Answers by Language