function intersection(list1, list2) {
  if(list1.tail !== list2.tail) {
    return null;
  }

  let i1 = list1.head;
  let i2 = list2.head;

  if(list1.size() > list2.size()) {
    for(let i = 0; i < list1.size() - list2.size(); i++) { i1 = i1.next; }
  }

  if(list2.size() > list1.size()) {
    for(let i = 0; i < list2.size() - list1.size(); i++) { i2 = i2.next; }
  }

  while(i1 !== i2) {
    i1 = i1.next;
    i2 = i2.next;
  }

  return i1;
}
If there's an intersection both ends are the same.

O(n)

@param list1
@param list2