Published
- 1 min read
check if js string begin with word
The solution for this is noted below
check if js string begin with word
Solution
const str1 = 'Saturday night plans'
console.log(str1.startsWith('Sat'))
// expected output: true
console.log(str1.startsWith('Sat', 3))
// expected output: false
Try other methods by searching on the site. That is if this doesn’t work