Javascript: Combining Strings into Array : <p>I have 3 strings that I need to convert into a single array, from there I want to filter out the <code>type: "bundle"</code>. </p>

<p>I need to note that I'm using Javascript Code by Zapier and their javascript library is a bit limited as far as the functions that I can use, but this is what I have so far which works if I hard code <code>itemArray</code>. I'm just having trouble creating my <code>itemArray</code> from the 3 given strings:</p>

<p>Strings:</p>

<pre><code>var type  = 'bundle, simple, simple';
var name  = 'Product1, Product2, Product3';
var price = '1.99, 2.99, 3.99';
</code></pre>

<p>I need to figure out how to convert the above 3 strings above into the following array using javascript:</p>

<pre><code>var itemArray = [
        {type:"bundle", info: {name: "Product1", price: "1.99"}},
        {type:"simple", info: {name: "Product2", price: "2.99"}},
        {type:"simple", info: {name: "Product3", price: "3.99"}}];
</code></pre>

<p>From there I'm looking to filter out the <code>bundle</code> product type and only return the <code>simple</code> product types, I'm doing that with the following code:</p>

<pre><code>// Using a for loop
var filtered = [];
for (var i = 0; i &lt; itemArray.length; ++i) {
    var item = itemArray[i];
    if (item.type == 'simple') filtered.push(item);
}

return {filtered}; //this returns just the 2 simple product type arrays
</code></pre>

<p>So my question is, how do I take those 3 strings that I began with and convert those into my <code>itemArray</code> format using javascript?</p>
