code: function (idx, arrayOrLength) {
          
          if (!Arrays._isNonNegativeInteger(idx))
              throw "IllegalArgumentException: idx must be a non-negative Integer.";
          
          if (Arrays.isArrayLike(arrayOrLength))
              arrayOrLength = arrayOrLength.length;
          
          if (   typeof arrayOrLength === 'number'
              && idx >= arrayOrLength )
              throw "IndexArrayOutOfBoundException: idx must be in the 0-" + (arrayOrLength - 1) + " range.";
      
      }
docs: Validates that <code>idx</code> represents a valid index value within
  <code>arrayOrLength</code>.
  @throws IllegalArgumentException If <code>idx</code> is not an Integer or
  is negative.
  @throws IndexArrayOutOfBoundException If <code>idx</code> is out of bound -
  Only validated if <code>arrayOrLength</code>
  is an Array-like object or a Number.