code: function sliceArrayFromRight(arr, startIndex, loop) {
      if (!loop) {
        startIndex += 1;
        arr = arr.slice(0, max(0, startIndex));
      }
      return arr;
    }
docs: When iterating from the right, indexes are effectively shifted by 1. For example, iterating from the right from index 2 in an array of 3 should also include the last element in the array. This matches the "lastIndexOf" method which also iterates from the right.