• Returns whether the given string starts with the prefix

    Parameters

    • Optionaltext: null | string

      the source string to check

    • Optionalprefix: null | string

      the target string to compare

    Returns boolean

    whether the given string starts with the prefix

    startsWith('foobar', 'foo');    // true
    startsWith('hello', 'bar'); // false