---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# String.prototype.startsWith()

The **`startsWith()`** method determines whether a string begins with the characters of a specified string, returning `true` or `false` as appropriate.

## Syntax

```js
startsWith(searchString)
startsWith(searchString, position)
```

### Parameters

- `searchString`
  - : The characters to be searched for at the start of this string. Cannot be a regex.
- `position` _**optional**_
  - : The start position at which `searchString` is expected to be found (the index of `searchString`'s first character). Defaults to `0`.

### Return value

**`true`** if the given characters are found at the beginning of the string; otherwise, **`false`**.

### Exceptions

- [`TypeError`](../../../globals/TypeError/TypeError.mdx)
  - : If `searchString` [is a regex](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp#special_handling_for_regexes).

## Description

This method lets you determine whether or not a string begins with another string. This method is case-sensitive.
