Programming-Idioms

History of Idiom 163 > diff from v14 to v15

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

Version 14

Version 15

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])
}