If I have a number of characters (either as a string or an array), does JavaScript have a function to tell me if any of those characters appear within a string?
For example, given the following, I want a function that returns true because str
does contain one of the characters in chars
.
const chars = [ '[', ']', '{', '}' ];
var str = "BlahBlah}";
In C#, I can use IndexOfAny()
, but I'm not finding a similar function in JavaScript.