The startsWith()
method checks the start of the string and matches it with the given value.
string.startsWith(searchString)
const name = 'Scan Skill';
console.log(name.startsWith('s')); // Prints: false
console.log(name.startsWith('S')); // Prints: true
The startsWith()
checks at the start of the string, if the given string matches with the string it is searching for, if it matches then it returns true, else returns false.