compose
const nums = [0,1,2,3,4,5];
const compose = (...fns) =>
fns.reduceRight((prev, next) => value => next(prev(value)), value => value);
const from = x => array => array.slice(x);
const to = x => array => array.slice(0, x);
const result = compose(
from(3),
to(5)
)(nums);
console.log(result);