Confusing Js Code

I found a chuck of code online, it is really confusing to read and I don't understand anything about how it works, Can someone explain me what is happening?

function add(val1, val2) {
      return function(continuation) {
         continuation(val1 + val2);
      };
  }
  function addR(continuation) {
      // if you don't have a return the last value
      // is implicitly returned!
      add(1,2)( function(x) { 
          add(x,3)( function(y) {
              // both x and y are available here
              add(x,y)( continuation );
          })
      });
  }
  addR(alert);