function endlessShift(array, position) {
  const wrappedIndex =
    ((position % array.length) + array.length) % array.length;
 
  return array[wrappedIndex];
}