JavaScript number array summation

eg.


var array = [1,2,3,4,5];

// sum = 1 + 2 + 3 + 4 + 5 = 15;

// join array

var array_join = array.join('+'); // => "1+2+3+4+5"

// eval string

var array_sum = eval(array_join); // => 15

eg.


//sum jQuery selector element values

var elements = $('input:checked')

var values = elements.map(function(){return $(this).val() - 0}).get();

var sum = eval(values.join('+'));