← TechnologyThe essentials of

startsWith(): check the start of text

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 12:40. This is not editorial approval.

In a few sentences

In brief

The method is sensitive to upper and lower case letters.

Useful to know

startsWith() checks if the string starts with a given sequence and returns a Boolean value. For example, "BG-104".startsWith("BG-") is true, and verification for "bg-" is false. [1]

For an internal product code, this may be exactly the desired behavior. If the input must be insensitive to letter case, define an explicit normalization rule. Do not use a text prefix as a background check for a secure URL or allowed file path: the structure and origin of such values require corresponding parsing and validation.

Sources

For further detail and to check the information:

  1. [1] MDN — String.startsWith ↗