Skip to content

Commit

Permalink
Add empty search string case (mdn#23280)
Browse files Browse the repository at this point in the history
* Add empty-search-string condition

Not obvious that '' is found at the beginning of every string, so helpful to make this explicit.

* Update files/en-us/web/javascript/reference/global_objects/string/startswith/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Align others

Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
jrpool and Josh-Cena authored Dec 31, 2022
1 parent d4ab88a commit da16bca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ endsWith(searchString, endPosition)

### Return value

**`true`** if the given characters are found at the end of the string; otherwise, **`false`**.
**`true`** if the given characters are found at the end of the string, including when `searchString` is an empty string; otherwise, **`false`**.

### Exceptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ includes(searchString, position)

### Return value

**`true`** if the search string is found anywhere within the given string; otherwise, **`false`** if not.
**`true`** if the search string is found anywhere within the given string, including when `searchString` is an empty string; otherwise, **`false`** if not.

### Exceptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ startsWith(searchString, position)

### Return value

**`true`** if the given characters are found at the beginning of the string; otherwise, **`false`**.
**`true`** if the given characters are found at the beginning of the string, including when `searchString` is an empty string; otherwise, **`false`**.

### Exceptions

Expand Down

0 comments on commit da16bca

Please sign in to comment.