How can i check array match string for example
var blocklist = ['jack','mark','jhon','fox'];
var str = "xxxxxxxxxxjackxxxxxxxxx";
How can i check for var str that not match array blocklist?
How can i check array match string for example
var blocklist = ['jack','mark','jhon','fox'];
var str = "xxxxxxxxxxjackxxxxxxxxx";
How can i check for var str that not match array blocklist?
You could find the string by using Array#includes.
var blocklist = ['jack', 'mark', 'jhon', 'fox'],
str = "xxxxxxxxxxjackxxxxxxxxx",
result = blocklist.find(s => str.includes(s));
console.log(result);