flip an array in javascript code example Example: reverse array in javascript const reverseArray = arr => arr.reduce((acc, val) => [val, ...acc], [])