JSFiddle - React, Tailwind, and code Playground
JavaScript
// Create our arrays
var blacklist = ["admn", "webform", "spoof"];
var newAccounts = ["admin", "[email protected]", "[email protected]"];
var invalidAccounts = [];
for(var x = 0; x < newAccounts.length; x++){
for(var y = 0; y < blacklist.length; y++){
if( newAccounts[x].indexOf(blacklist[y]) > -1){
alert(blacklist[x] + " is in the blacklist array");
// Push the newAccounts value into the invalidAccounts array since it contains
// a blacklist word.
invalidAccounts.push(newAccounts[x]);
}else{
alert('no matches');
}
}
}