startsWith

Checks if the input string starts with the specified substring.

startsWith

Checks if the input string starts with the specified substring.

Type: transform

Parameters

  • input (unknown): The input string to check.
  • search (string): The substring to search for at the beginning.

Returns

Type: boolean

True if the input starts with the search string, false otherwise.

Examples

startsWith("hello world", "hello") // true
"foo-bar"|startsWith("foo") // true
startsWith("test", "xyz") // false
Cookie Notice

We use cookies to enhance your browsing experience.