code: function(range1, range2) {
          if (!range1) {
              return range2;
          }
          if (!range2) {
              return range1;
          }
          var range2Start = range2[0];
          var range2End = range2Start + range2[1] - 1;
          var range1Start = range1[0];
          var range1End = range1Start + range1[1] - 1;
          var resultStart = (range1Start < range2Start ? range1Start : range2Start);
          return [
              resultStart, (range1End > range2End ? range1End : range2End) - resultStart + 1
          ];
      }
docs: takes a point and a length as the ranges in array form