JS: String.prototype.startsWith
(new in ECMAScript 2015)
str.startsWith(searchString)-
- Return
trueif str starts with searchString. - Else, return
false.
console.log("abcd".startsWith("ab")); console.log("abcd".startsWith("b") === false); - Return
str.startsWith(searchString, position)-
Check if start from position.
console.log("abcd".startsWith("b", 1));