Generate price from a list with Javascript variables
<p>I have a few variables:</p>

<pre><code>var test1 = 1500;
var test2 = 500;
var test3 = 3000;
var test4 = 20000;
</code></pre>

<p>And I have an another variable like this:</p>

<pre><code>var list = 'test3,test1';
</code></pre>

<p>This is not fixed obviously, so that can be <code>'test4,test1,test2'</code> etc..</p>

<p>Now, I need a price variable. <code>test3+test1 = 4500</code></p>

<pre><code>var price = '4500';
</code></pre>

<p>But I don't have any idea how to do that. Here is what I have so far:</p>

<pre><code>var names = [];
$(':checkbox:checked').each(function() {
    names.push(this.name);
});
var list = names.join(',');
</code></pre>

<p>Any ideas?</p>
