Tweakr
    Preparing search index...

    Function startsWith

    • Checks if a string starts with the given prefix.

      Parameters

      • str: string

        The string to check.

      • prefix: string

        The prefix to match at the start of the string.

      Returns boolean

      true if the string starts with the prefix, otherwise false.

      1.1.0

      startsWith("hello world", "hello"); // true
      startsWith("hello world", "world"); // false
      startsWith("typescript", "ts"); // true