Given the following function definitions:

var compose = function (f,g) {
                 return function (x) {
                    return f(g(x));
              };
};
var f = function (x) { return 4 * x - 3; };
var g = function (x) { return 2 * x + 2; };

what is the value of the following function call?
compose( f , g )( 3 )

29
  • 20
  • 30
  • 28
  • error

Is f or g invoked first when the two functions are composed as done in this function call?