Compare two strings and output result where both are equal : <p>I have two strings, and I want to output one string where both give the same values. 
e.g.</p>

<pre><code>var string1 = "ab?def#hij@lm";
var string2 = "abcd!f#hijkl]";

//expected output would be "abcdef#hijklm"
</code></pre>

<p>I have thought a way to do this would be to assign each character to an array, then compare each character individually but that seems inefficient, as I'm going to pass this through strings with tens of thousands of characters.</p>

<p>Any help is appreciated, doesn't have to be code, just to guide me in the general direction. </p>
