Logo

Programming-Idioms

History of Idiom 163 > diff from v14 to v15

Edit summary for version 15 by mtdh:
New JS implementation by user [mtdh]

Version 14

2019-06-07, 10:31:28

Version 15

2019-09-26, 19:01:59

Idiom #163 Print list elements by group of 2

Print all the list elements, two by two, assuming list length is even.

Idiom #163 Print list elements by group of 2

Print all the list elements, two by two, assuming list length is even.

Code
for (let index = 0; index < list.length; index = index + 2) {
  console.log(list[index], list[index + 1])
}