DEV Community

loading...

Discussion on: Daily Challenge #306 - Largest Possible Product

Collapse
jehielmartinez profile image
Jehiel Martinez

JS

largestProduct = (arr) => {
  const results = []
  for (i=0; i<arr.length-1; i++){
    results.push(arr[i] * arr[i+1])
  }
  return Math.max(...results)
}
Enter fullscreen mode Exit fullscreen mode