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
  • 26,308
  • 17
  • 56
  • 95
newtocode
  • 21
  • 1
  • 4

0 Answers0