Checks if string starts with the given target string.
string
The string to inspect.
The string to search for.
The position to search from.
Returns true if string starts with target, else false.
true
target
false
5.2.0
[[endsWith]], [[includes]]
startsWith('abc', 'a')// => truestartsWith('abc', 'b')// => falsestartsWith('abc', 'b', 1)// => true Copy
startsWith('abc', 'a')// => truestartsWith('abc', 'b')// => falsestartsWith('abc', 'b', 1)// => true
Checks if
string
starts with the given target string.