function StringSubstr(start, length) {
  CHECK_OBJECT_COERCIBLE(this, "String.prototype.substr");
  var s = TO_STRING(this);
  var size = s.length;
  start = TO_INTEGER(start);
  length = IS_UNDEFINED(length) ? size : TO_INTEGER(length);

  if (start < 0) start = MaxSimple(size + start, 0);
  length = MinSimple(MaxSimple(length, 0), size - start);

  if (length <= 0) return '';
  return %_SubString(s, start, start + length);
}
function StringSubstr(start, length) {
  CHECK_OBJECT_COERCIBLE(this, "String.prototype.substr");
  var s = TO_STRING(this);
  var size = s.length;
  start = TO_INTEGER(start);
  length = IS_UNDEFINED(length) ? size : TO_INTEGER(length);

  if (start < 0) start = MaxSimple(size + start, 0);
  length = MinSimple(MaxSimple(length, 0), size - start);

  if (length <= 0) return '';
  return %_SubString(s, start, start + length);
}
function StringSubstr ( start , length ) { CHECK_OBJECT_COERCIBLE ( this , "String.prototype.substr" ) ; var s = TO_STRING ( this ) ; var size = s . length ; start = TO_INTEGER ( start ) ; length = IS_UNDEFINED ( length ) ? size : TO_INTEGER ( length ) ; if ( start < 0 ) start = MaxSimple ( size + start , 0 ) ; length = MinSimple ( MaxSimple ( length , 0 ) , size - start ) ; if ( length <= 0 ) return '' ; return % _SubString ( s , start , start + length ) ; }
ecma262/#sec-string.prototype.substr
ecma262 / #sec - string . prototype . substr