Advertisement
Zekrommaster110

[JS] string contains function

Sep 19th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     contains("hey ho what's up", ["e", "ho", "lel", "xd"])
  3.     -> returns true
  4. */
  5. function contains(inp, identifiers) {
  6.     for (var i in identifiers)
  7.         if (inp.indexOf(identifiers[i]) > -1)
  8.             return true;
  9.     return false;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement