Organizational Research By

Surprising Reserch Topic

How do i can check if one string contains another substring?


How can I check if one string contains another substring in JavaScript? Usually I would expect a String.contains() method, but there doesn't seem to be one.

asked Jun 30, 2015 in JAVASCRIPT by rajesh
0 votes
62 views



Related Hot Questions

1 Answer

0 votes

With ECMAScript 2015, we got a little nicer method called includes()

 

let s = "foo";
console.log(s.includes("oo"));
answered Jun 30, 2015 by rajesh

...