enumeration in js code example

Example 1: javascript enumerate

const foobar = ['A', 'B', 'C'];

for (const [index, element] of foobar.entries()) {
  console.log(index, element);
}

Example 2: javascript enumerators

array.every(elm,index,array) // Did all elements satisfy the callback?
array.find(elm,index,array) // Find the first element that satisfies the callback
array.findIndex(elm,index,array) // Find the first element that satisfies the callback's index
array.map(elm,index,array) // Transform every element and create a new array
array.reduce(accumulator,elm,index,array) // Reduce every element into a new value
array.some(elm,index,array) // Did any element satisfy the callback?