How to check string contains in another string in es6

 we can use contains(), indexOf() method to check if one String contains another String in JavaScript/es6

const string = "JavaScript"; const substring = "Java"; const result = string.includes(substring));

or

 
const results = string.indexOf(substr) !== -1;

Comments

Popular posts from this blog

world tourism guide Template

Es6 how to check if value is not null or undefined?