function FunctionStack(fns, lifo) {

  // handle lack of new
  if (!(this instanceof FunctionStack)) return new FunctionStack(fns, lifo);

  // initialize our stack
  this.stack = [];

  // if fns to handle
  if (fns) {
    var fn;
    // check for inverse
    if (lifo) {
      // push elements to stack last to first
      for (var i=fns.length-1;i>=0;i--) {
        fn = fns[i];
        this.push(fn);
      }
    } else {
      // push elements to stack first to last
      for (var j=0;j<fns.length;j++) {
        fn = fns[j];
        this.push(fn);
      }
    }
  }
}
/**
 * FunctionStack
 * @param fns
 * @param lifo
 * @returns {FunctionStack}
 * @constructor
 *
 * a special kind of stack where length is meant to be 0
 * initializes with list of functions to execute, then
 * runs through them.
 *
 * the lifo parameter tells whether to shift or pop functions
 */
FunctionStack
@param fns
@param lifo
@returns {FunctionStack}
@constructor

a special kind of stack where length is meant to be 0
initializes with list of functions to execute, then
runs through them.

the lifo parameter tells whether to shift or pop functions
FunctionStack @param fns @param lifo @returns { FunctionStack } @constructor a special kind of stack where length is meant to be 0 initializes with list of functions to execute then runs through them . the lifo parameter tells whether to shift or pop functions
function FunctionStack(fns, lifo) {
  if (!(this instanceof FunctionStack)) return new FunctionStack(fns, lifo);
  this.stack = [];
  if (fns) {
    var fn;
    if (lifo) {
      for (var i=fns.length-1;i>=0;i--) {
        fn = fns[i];
        this.push(fn);
      }
    } else {
      for (var j=0;j<fns.length;j++) {
        fn = fns[j];
        this.push(fn);
      }
    }
  }
}
function FunctionStack ( fns , lifo ) { if ( ! ( this instanceof FunctionStack ) ) return new FunctionStack ( fns , lifo ) ; this . stack = [ ] ; if ( fns ) { var fn ; if ( lifo ) { for ( var i = fns . length - 1 ; i >= 0 ; i -- ) { fn = fns [ i ] ; this . push ( fn ) ; } } else { for ( var j = 0 ; j < fns . length ; j ++ ) { fn = fns [ j ] ; this . push ( fn ) ; } } } }
FunctionStack
 @param fns
 @param lifo
 @returns {FunctionStack}
 @constructor
FunctionStack @param fns @param lifo @returns { FunctionStack } @constructor
// handle lack of new // initialize our stack // if fns to handle // check for inverse // push elements to stack last to first // push elements to stack first to last