I need to write a function which will clean my array (array 1) :
"yellow pants","black jeans","blue sweater"
From colors, which I keep in array 2.
"yellow","black","blue"
I am iterating over my array 1st and would like a function to clean it from values stacked in array 2
Previously I just defined
function clear(a)
{
var pattern = /[*,()-.;#&^@?]/g;
var cleared = a.replace(pattern ,'');
return cleared;
}
, where "a" was an element of array 1. But now my "pattern" is multiple string array.
How do I do that using replace() or other function?
I am not comparing 2 arrays at once... I need to compare one element from 1st array with all of the elements from 2nd one. Bet that's not the duplicate of the posted question...