Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if js string begin with word

const str1 = 'Saturday night plans';

console.log(str1.startsWith('Sat'));
// expected output: true

console.log(str1.startsWith('Sat', 3));
// expected output: false
 
PREVIOUS NEXT
Tagged: #check #js #string #word
ADD COMMENT
Topic
Name
2+6 =