2

I dont understand how this function returns 6. I was going to explain the part I don't understand and could not put it into words. I would really appreciate a simple explanation.

var add = function(a) {
    return function(b){
        return a + b;
    }
};

var addToFive = add(5);
console.log(addToFive(1));
Federico klez Culloca
  • 24,336
  • 15
  • 57
  • 93
newtocode
  • 21
  • 1
  • 2

0 Answers0