JavaScript has several very useful methods for working with arrays, e.g. .forEach, .map, .filter and .reduce.
However, the version of JavaScript in the workflow is too old to have them, you must therefore include a polyfill
like this one.
You can take advantage of function hoisting (which means function are usable, even if their definition is after the code) as such:
extendArray() // => This will add the above mentioned methods on Array objects