DEV Community

Discussion on: Daily Challenge #265 - Equal Sides

Collapse
dimitrilahaye profile image
Dimitri Lahaye

My humble solution:

function findN(array) {
  reducer = (s, o) => s + o;
  return array.findIndex((a, i, arr) => arr.slice(0, i).reduce(reducer, 0) === arr.slice(i + 1 - array.length).reduce(reducer, 0));
}