Skip to content

Commit 507c05f

Browse files
authored
Improve substring description (mdn#22559)
The previous version of the text made it reasonable to assume that if the text would be "Mozilla" and the indexes `(1, 3)`, the end result will be the character `z`, i.e. the string "between the start and end indexes". Since that would be very unusual, many users might instead assume that it would result in `ozi`. But that would also be incorrect. This change makes it clear that the function includes the first index and excludes the second.
1 parent e0bc3b1 commit 507c05f

File tree

1 file changed

+1
-1
lines changed
  • files/en-us/web/javascript/reference/global_objects/string/substring

1 file changed

+1
-1
lines changed

files/en-us/web/javascript/reference/global_objects/string/substring/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ browser-compat: javascript.builtins.String.substring
1212

1313
{{JSRef}}
1414

15-
The **`substring()`** method returns the part of the `string` between the start and end indexes, or to the end of the string.
15+
The **`substring()`** method returns the part of the `string` from the start index up to and excluding the end index, or to the end of the string if no end index is supplied.
1616

1717
{{EmbedInteractiveExample("pages/js/string-substring.html")}}
1818

0 commit comments

Comments
 (0)