function intersection(interval1, interval2) {
		if ( interval2[0] > interval1[1] || interval1[0] > interval2[1]) {
			return null;
		} else {
			return [Math.max(interval1[0], interval2[0]), Math.min(interval1[1], interval2[1])];
		}
	}
Returns the intersection of two intervals. When the intervals don't
intersect at all, <code>null</code> is returned.

For example, <code>intersection([0, 3], [2, 4])</code> returns
<code>[2, 3]</code>

@param {number[]} interval1 The first interval
@param {number[]} interval2 The second interval
@returns {number[]|null} The intersection or null when the intervals are apart from each other