Skip to main content
2 of 2
Changed map to forEach
Qtax
  • 396
  • 2
  • 7

Anything wrong with the naive ways?

let large = [];
let small = [];

array.forEach((x) => (x > 10 ? large : small).push(x));

// or
for(const x of array){
    (x > 10 ? large : small).push(x);
}
Qtax
  • 396
  • 2
  • 7