Cannot replace String portion based on Array in Javascript
<p>I have two arrays, one is for a case and other one for b case. I want bodyTags string which consist one or more of different arr1 items to be replaced with items from arr2 with the same index.</p>

<p>Code below doesn't work. If you can fix it or advice me how to achieve desired effect with jQuery this will really help me out.</p>

<pre><code>var arr1 = ["1a", "2a", "3a", "4a", "5a", "a6", "7a", "8a", "9a"];
var arr2 = ["1b", "2b", "3b", "4b", "5b", "6b", "7b", "8b", "9b"];

    var bodyTags = 'something a1 got funcky a6';

    for (var i = 0; i &lt; arr1.length; i++) {
        bodyTags = bodyTags.replace(/arr1[i]/gi, arr2[i]);
    }
</code></pre>
