goldies
    Preparing search index...

    Function startsWith

    • Determines if a haystack string starts with a specified needle substring, case-insensitive.

      Parameters

      • haystack: string

        The main string to check.

      • needle: string

        The substring to check if the main string starts with.

      Returns boolean

      True if the main string starts with the specified substring, false otherwise.

      const haystack = 'Hello, world!';
      startsWith(haystack, 'hello'); // returns true

      Use the built-in startsWith, lowercasing both strings for the same case-insensitive check: haystack.toLowerCase().startsWith(needle.toLowerCase()). Will be removed in goldies 6.0.