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);
}
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);
}