function compose(f, g) {

  return function() {

    return f(g.apply(this, arguments));

  };

}

 

---

function compose(f,g) {

  return function(...a) {

    return f(g(...a));

  }

}

 

---

var compose = (f,g) => (...args) => f(g(...args));