HI WELCOME TO KANSIRIS

How to check if string contains substring?

Leave a Comment

 var str = ‘This is a test’;

console.log(str.includes(‘good’)); // shows true
console.log(str.includes(‘Good’)); // shows false

1
2
3
if(str.contains("test")){
    alert("String Found");
}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.