Link to home
Start Free TrialLog in
Avatar of Temir Aliev
Temir AlievFlag for United States of America

asked on

What is going on on line 1 and 2? Why didn't we write anything inside the curly braces on line 2?

var SequenceSum = (function() {
  function SequenceSum() {}

  SequenceSum.showSequence = function(count) {
    var holder = [];
    for ( var i = 0; i <= count; i++){
      holder.push(i);
    }
    var a = holder.reduce(function(a, b){
      return a + b;
    })
    return a;
  };

  return SequenceSum;

})();
console.log(SequenceSum.showSequence(6))

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jim Riddles
Jim Riddles
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Temir Aliev

ASKER

Thanks a lot, makes sense now