JSFiddle - React, Tailwind, and code Playground

by Swapnil Khamkar

JavaScript

// Create our arrays
var blacklist = ["admin", "webform", "spoof"];
var newAccounts = ["[email protected]", "[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');
		  }
	}
}