Could any one explain how this function alert, when more no of brackets of parameters are passed. I could not able to understand it clearly.
function sum(a) {
          
        
The thing to look at is this piece of code
function f(b) {
    sum += b
    return f
  }
This function returns reference to itself so it can be called as many times as possible. An important thing about it is that it has a tostring function that gets called and since tostring is defined inside function sum() it has access to the variable sum and its value current value (that is changed by f() )