code: function getPair(index, layer) {
    const pairIndex = index % 2 ? index - 1 : index + 1; // if odd return the index before it, else if even return the index after it
    if (pairIndex < layer.length) {
      return layer[pairIndex];
    }
    return null; // this happens when the given index is the last element in a layer with odd number of elements
  }
docs: This function takes a given index and determines if it is the first or second element in a pair, then returns the first element of the pair
  If the given index is the last element in a layer with an odd number of elements, then null is returned
  E.g 1:
  
  layer = [ A, B, C, D ],
  if index = 2, then return A
  if index = 3, then return C
  
  E.g 2:
  
  layer = [ A, B, C, D, E]
  if index = 5, then return null
  if index = 4, then return C
  
  @param {*} index
  @param {*} layer