One of the most common operations that programmers use on strings is to check whether a string contains some other string.
In this post you will see how to check string contains whether other string.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
var str="Welcome to Code 4 Example"; console.log(str.includes('Code')); //true //check string whether contains "Code" if(str.includes('Code')) { //string contains "Code" } else { //string not contains "code" } |