recently , I'm learning coding , and here's the code of teaching closure
function accumulator(){
let sum =0;
return (num) =>{
sum = sum + num;
return sum;
}
}
const acc = accumulator();
acc(3)
acc(5)
result :3 & 8
Now , I've a question , why the parameter of acc(3) which is equal to accumulator(3) can be passed down to inner function parameter num , (num)=> , without any variable declared? any concept involved in closure?