DEV Community

loading...

Discussion on: Daily Challenge #306 - Largest Possible Product

Collapse
_bkeren profile image
''

JS

const adjacentProduct = arr => arr
  .slice(0, -1)
  .reduce(
    (max, n, i) => Math.max(max, n * arr[i + 1]), -Infinity
  )


Enter fullscreen mode Exit fullscreen mode