Determines whether a string begins with the characters of a specified string.
Syntax
str.startsWith(searchStr, position?)Example
Enter values below to update the example in real time.
const→url→console→startsWith→const url = "https://example.com";
console.log(url.startsWith("https")); // true
console.log(url.startsWith("http://")); // false